Re: [PATCH 02/22] Do not sanity check order in the fast path

From: Andrew Morton
Date: Thu Apr 23 2009 - 18:50:45 EST


On Wed, 22 Apr 2009 18:11:51 +0100
Mel Gorman <mel@xxxxxxxxx> wrote:

> > I depend on the allocator to tell me when I've fed it too high of an
> > order. If we really need this, perhaps we should do an audit and then
> > add a WARN_ON() for a few releases to catch the stragglers.
> >
>
> I consider it buggy to ask for something so large that you always end up
> with the worst option - vmalloc().

Nevertheless, it's a pretty common pattern for initialisation code all
over the kernel to do

while (allocate(huge_amount) == NULL)
huge_amount /= 2;

and the proposed change will convert that from "works" to "either goes
BUG or mysteriously overindexes zone->free_area[] in
__rmqueue_smallest()". The latter of which is really nasty.

> How about leaving it as a VM_BUG_ON
> to get as many reports as possible on who is depending on this odd
> behaviour?

That would be quite disruptive. Even emitting a trace for each call
would be irritating. How's about this:

--- a/mm/page_alloc.c~page-allocator-do-not-sanity-check-order-in-the-fast-path-fix
+++ a/mm/page_alloc.c
@@ -1405,7 +1405,8 @@ get_page_from_freelist(gfp_t gfp_mask, n

classzone_idx = zone_idx(preferred_zone);

- VM_BUG_ON(order >= MAX_ORDER);
+ if (WARN_ON_ONCE(order >= MAX_ORDER))
+ return NULL;

zonelist_scan:
/*
_


and then we revisit later?
--
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/