lkml.org 
[lkml]   [2008]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 3/6] mempolicy: add MPOL_F_STATIC_NODES flag
David wrote:
+static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
+{
+ return !!(pol->flags & MPOL_F_STATIC_NODES);
+}

Why the double-negative? As best as I can tell, the return value of
mpol_store_user_nodemask() is only used in conditional contexts:

$ grep mpol_store_user_nodemask mm/mempolicy.c
static inline int mpol_store_user_nodemask(const struct mempolicy *pol)
if (mpol_store_user_nodemask(policy))
if (!mpol_store_user_nodemask(a))
if (!mpol_store_user_nodemask(pol) &&

So I see no need to waste the instructions needed (in the three copies
of this code, since it's static inline) to convert a non-zero value to
exactly the value 1.

Hmmm ... speaking of static inline ... I can knock 600 bytes (that's
IA64 bytes, so equivalent to about 300 x86 bytes) off the kernel text
size by not inlining the mm/mempolicy.c routines check_pgd_range() and
interleave_nid(). I wonder if that would be worth doing. Perhaps
those two routines are in sufficiently tight corners that the duplicate
copies of them is needed.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214


\
 
 \ /
  Last update: 2008-02-26 06:49    [W:0.271 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site