lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 Feb 2008 12:02:28 -0800 (PST)
From:	David Rientjes <rientjes@...gle.com>
To:	Christoph Lameter <clameter@....com>
cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Jackson <pj@....com>,
	Lee Schermerhorn <Lee.Schermerhorn@...com>,
	Andi Kleen <ak@...e.de>, linux-kernel@...r.kernel.org
Subject: Re: [patch 1/4] mempolicy: convert MPOL constants to enum

On Mon, 11 Feb 2008, Christoph Lameter wrote:

> Then you could follow through with the enum mempolicy thing 
> throughtout. Why not use enum mempolicy in struct mempolicy?
> 

Mempolicy flags, as I implemented them in patch 2 in this series, are not 
integer constants that are enumerated starting at 0.  They are individual 
bits that are shifted a pre-defined length and intersected with the 
enumerated mode.  This allows both the mode and the flags to be stored in 
the same object.

Just because enum mempolicy_mode is the equivalent of passing an int in C 
is irrelevant; its semantics are that the value is coming from enum 
mempolicy_mode.  That includes _only_ the mode itself:

	enum mempolicy_mode {
		MPOL_DEFAULT,
		MPOL_BIND,
		MPOL_PREFERRED,
		MPOL_INTERLEAVE,
		MPOL_MAX,
	};

And changing the policy member of struct mempolicy to 'enum 
mempolicy_mode' instead of 'unsigned short' would increase its size.  Not 
that it matters, since in the third patch I add a whole nodemask_t, but 
it's simply unnecessary.  Right now we have the capacity to store 256 
individual mempolicy modes (we currently use four) and eight mempolicy 
flags with unsigned short.

		David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ