lkml.org 
[lkml]   [2008]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 05/19] split LRU lists into anon & file sets
From
Date
On Fri, 2008-01-11 at 15:24 +0900, KOSAKI Motohiro wrote:
> Hi Rik
>
> > +static inline int is_file_lru(enum lru_list l)
> > +{
> > + BUILD_BUG_ON(LRU_INACTIVE_FILE != 2 || LRU_ACTIVE_FILE != 3);
> > + return (l/2 == 1);
> > +}
>
> below patch is a bit cleanup proposal.
> i think LRU_FILE is more clarify than "/2".
>
> What do you think it?
>
>
>
> Index: linux-2.6.24-rc6-mm1-rvr/include/linux/mmzone.h
> ===================================================================
> --- linux-2.6.24-rc6-mm1-rvr.orig/include/linux/mmzone.h 2008-01-11 11:10:30.000000000 +0900
> +++ linux-2.6.24-rc6-mm1-rvr/include/linux/mmzone.h 2008-01-11 14:40:31.000000000 +0900
> @@ -147,7 +147,7 @@
> static inline int is_file_lru(enum lru_list l)
> {
> BUILD_BUG_ON(LRU_INACTIVE_FILE != 2 || LRU_ACTIVE_FILE != 3);
> - return (l/2 == 1);
> + return !!(l & LRU_FILE);
> }
>
> struct per_cpu_pages {
>

Kosaki-san:

Again, my doing. I agree that the calculation is a bit strange, but I
wanted to "future-proof" this function in case we ever get to a value of
'6' for the lru_list enum. In that case, the AND will evaluate to
non-zero for what may not be a file LRU. Between the build time
assertion and the division [which could just be a 'l >> 1', I suppose]
we should be safe.

Thanks,
Lee



\
 
 \ /
  Last update: 2008-01-11 16:51    [W:0.160 / U:3.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site