LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Paul Jackson <pj@sgi.com>
Cc: akpm@linux-foundation.org, clameter@sgi.com,
	Lee.Schermerhorn@hp.com, ak@suse.de,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 1/6] mempolicy: convert MPOL constants to enum
Date: Mon, 25 Feb 2008 19:35:46 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0802251931030.6021@chino.kir.corp.google.com> (raw)
In-Reply-To: <20080225212056.ca388983.pj@sgi.com>

On Mon, 25 Feb 2008, Paul Jackson wrote:

> +enum {
> +	MPOL_DEFAULT,
> +	MPOL_PREFERRED,
> +	MPOL_BIND,
> +	MPOL_INTERLEAVE,
> +	MPOL_MAX,	/* always last member of enum */
> 
> Aren't the values that these constants take part of the
> user visible kernel API?
> 
> In other words, if someone added another MPOL_* in the middle
> of this enum, it would break mbind/set_mempolicy/get_mempolicy
> users, right:
> 
> +enum {
> +	MPOL_DEFAULT,
> +	MPOL_PREFERRED,
> +	MPOL_YET_ANOTHER_FLAG,		/* <== added flag ... oops */
> +	MPOL_BIND,
> +	MPOL_INTERLEAVE,
> +	MPOL_MAX,	/* always last member of enum */
> 

I don't suspect that a kernel developer is going to make such an egregious 
error.  The user would need to be using a new linux/mempolicy.h with an 
old kernel to get the wrong behavior.

> I'm thinking that we should still specify the specific value
> of each of these flags, by way of documenting these necessary
> values, as in:
> 
> +enum {
> +	MPOL_DEFAULT = 0,
> +	MPOL_PREFERRED = 1,
> +	MPOL_BIND = 2,
> +	MPOL_INTERLEAVE = 3,
> +	MPOL_MAX,	/* always last member of enum */
> 

That looks overly redundant to me and doesn't protect against adding 
MPOL_YET_ANOTHER_FLAG in the middle of preferred and bind to get two mode 
values with the int value of 1.

		David

  reply	other threads:[~2008-02-26  3:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-25 15:35 David Rientjes
2008-02-25 15:35 ` [patch 2/6] mempolicy: support optional mode flags David Rientjes
2008-02-25 15:35   ` [patch 3/6] mempolicy: add MPOL_F_STATIC_NODES flag David Rientjes
2008-02-25 15:35     ` [patch 4/6] mempolicy: add bitmap_onto() and bitmap_fold() operations David Rientjes
2008-02-25 15:35       ` [patch 5/6] mempolicy: add MPOL_F_RELATIVE_NODES flag David Rientjes
2008-02-25 15:35         ` [patch 6/6] mempolicy: update NUMA memory policy documentation David Rientjes
2008-02-26 17:34           ` Paul Jackson
2008-02-26 21:23             ` David Rientjes
2008-02-26  6:12         ` [patch 5/6] mempolicy: add MPOL_F_RELATIVE_NODES flag Paul Jackson
2008-02-26  6:45           ` David Rientjes
2008-02-26 17:44         ` Paul Jackson
2008-02-26 21:17           ` David Rientjes
2008-02-26 21:30             ` Paul Jackson
2008-02-26 21:27           ` Lee Schermerhorn
2008-02-27  1:17         ` David Rientjes
2008-02-27  1:31           ` David Rientjes
2008-02-27  2:30           ` Paul Jackson
2008-02-27 15:37           ` Lee Schermerhorn
2008-02-27 17:09             ` Paul Jackson
2008-02-28 21:08             ` David Rientjes
2008-02-26  5:46     ` [patch 3/6] mempolicy: add MPOL_F_STATIC_NODES flag Paul Jackson
2008-02-26  6:53       ` David Rientjes
2008-02-26 17:56     ` Paul Jackson
2008-02-26 21:02       ` David Rientjes
2008-02-26 21:32         ` Lee Schermerhorn
2008-02-26 21:54           ` David Rientjes
2008-02-26 22:08             ` Paul Jackson
2008-02-26 21:39         ` Paul Jackson
2008-02-26  3:20 ` [patch 1/6] mempolicy: convert MPOL constants to enum Paul Jackson
2008-02-26  3:35   ` David Rientjes [this message]
2008-02-26  4:02     ` Paul Jackson
2008-02-26  4:21       ` David Rientjes
2008-02-26  4:46         ` Paul Jackson
2008-02-27 19:35 ` Christoph Lameter
2008-02-27 19:59   ` David Rientjes
2008-03-01  0:44 David Rientjes
2008-03-03  7:17 ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0802251931030.6021@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=Lee.Schermerhorn@hp.com \
    --cc=ak@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --subject='Re: [patch 1/6] mempolicy: convert MPOL constants to enum' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).