Re: [PATCH 2/2] Optimize compound_head() by avoiding a shared pageflag

From: Andrew Morton
Date: Sat Apr 07 2007 - 21:25:52 EST


On Sat, 7 Apr 2007 17:21:38 -0700 (PDT) Christoph Lameter <clameter@xxxxxxx> wrote:

> On Sat, 7 Apr 2007, Andrew Morton wrote:
>
> > Which is all a ton of fun, but this subversion of the architecture's
> > freedom to use volatile, memory barriers etc is a worry. We do the same in
> > page_alloc.c, of course...
>
> I just tried the approach that we discussed earlier and it was not
> nice either.

We've discussed at least three approaches, so we don't know to what you refer.

> Lets just use a page flag please.

Nope, try harder.

PageCompound is an unlikely case. Back in the old days we would have done



if (PageCompound(page))
goto out_of_line;
back:

do_stuff_with(page);
return;

out_of_line:
if (PageTail(page)) {
page = page_tail(page);
goto back;
}
<do other stuff>

and nowadays we hope that gcc does the above for us. If it doesn't do it
for us, perhaps it needs open-coded help.

Because I don't expect there will be much efficiency difference between the
above and the use of another page flag.

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