lkml.org 
[lkml]   [2007]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] Optimize compound_head() by avoiding a shared page flag
On Mon, 9 Apr 2007, Andrew Morton wrote:

> > The patch adds PageTail(page) and PageHead(page) to check if a page is the
> > head or the tail of a compound page. This is done by masking the two
> > bits describing the state of a compound page and then comparing them. So
> > one comparision and a branch instead of two bit checks and two branches.
> >
>
> OK. I'm still a bit concerned about bypassing the bitops synchronisation:
> barriers, volatile, etc. We had lengthy ruminations on that a few years
> ago, I think when working on free_pages_check().

Those are important for bits that are changing while a page is in use.
These are constant.

> > +#define __SetPageTail(page) page->flags |= PG_head_tail_mask
> > +#define __ClearPageTail(page) page->flags ~= PG_head_tail_mask
>
> hm. The lack of parenthesisation here _might_ be OK, but I haven't
> thought it through.

This is a command and not an expression. Ok will inline.

> And I'd prefer not to have to, because I know that the do { } while (0)
> thing works. As do static inline functions.
>
> > +#define PageHead(page) ((page->flags & PG_head_tail_mask) \
> > + == (1L << PG_compound))
> > +#define __SetPageHead(page) __SetCompoundPage(page)
> > +#define __ClearPageHead(page) __ClearCompoundPage(page)
>
> You meant __SetPageCompound and __ClearPageCompound.

Right.

-
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: 2007-04-09 20:51    [W:0.166 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site