Re: [RFC PATCH 4/6] mm, compaction: skip buddy pages by their order in the migrate scanner

From: David Rientjes
Date: Thu Jun 12 2014 - 17:49:26 EST


On Thu, 12 Jun 2014, Vlastimil Babka wrote:

> > Ok, and I won't continue to push the point.
>
> I'd rather know I'm correct and not just persistent enough :) If you confirm
> that your compiler behaves differently, then maybe making page_order_unsafe a
> #define instead of inline function would prevent this issue?
>

The reason I was hesitatnt is because there's no way I can prove under all
possible circumstances in which page_order_unsafe() could be used that gcc
won't make the decision to reaccess. I personally didn't think that doing

if (PageBuddy(page)) {
/*
* Racy check since we know PageBuddy() is true and we do
* some sanity checking on this scan to ensure it is an
* appropriate order.
*/
unsigned long order = ACCESS_ONCE(page_private(page));
...
}

was too much of a problem and actually put the ACCESS_ONCE() in the
context in which it matters rather than hiding behind an inline function.

> > I think the lockless
> > suitable_migration_target() call that looks at page_order() is fine in the
> > free scanner since we use it as a racy check, but it might benefit from
> > either a comment describing the behavior or a sanity check for
> > page_order(page) <= MAX_ORDER as you've done before.
>
> OK, I'll add that.
>

Thanks!
--
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/