lkml.org 
[lkml]   [2006]   [May]   [26]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 27 May 2006 10:12:52 +0800
FromWu Fengguang <>
SubjectRe: [PATCH 17/33] readahead: context based method
On Fri, May 26, 2006 at 10:23:43AM -0700, Andrew Morton wrote:
> Wu Fengguang <wfg@mail.ustc.edu.cn> wrote:
> >
> > +#define PAGE_REFCNT_0           0
> >  +#define PAGE_REFCNT_1           (1 << PG_referenced)
> >  +#define PAGE_REFCNT_2           (1 << PG_active)
> >  +#define PAGE_REFCNT_3           ((1 << PG_active) | (1 << PG_referenced))
> >  +#define PAGE_REFCNT_MASK        PAGE_REFCNT_3
> >  +
> >  +/*
> >  + * STATUS   REFERENCE COUNT
> >  + *  __                   0
> >  + *  _R       PAGE_REFCNT_1
> >  + *  A_       PAGE_REFCNT_2
> >  + *  AR       PAGE_REFCNT_3
> >  + *
> >  + *  A/R: Active / Referenced
> >  + */
> >  +static inline unsigned long page_refcnt(struct page *page)
> >  +{
> >  +        return page->flags & PAGE_REFCNT_MASK;
> >  +}
> >  +
> 
> This assumes that PG_referenced < PG_active.  Nobody knows that this
> assumption was made and someone might go and reorder the page flags and
> subtly break readahead.
> 
> We need to either not do it this way, or put a big comment in page-flags.h,
> or even redefine PG_active to be PG_referenced+1.

I have had a code segment like:

#if PG_active < PG_referenced
#  error unexpected page flags order
#endif

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

\
 
 \ /
  Last update: 2006-05-27 04:15    [from the cache]
©2003-2008