[lkml]   [2009]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [PATCH 02/22] Do not sanity check order in the fast path
On Wed, 22 Apr 2009 18:11:51 +0100
Mel Gorman <> 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;


and then we revisit later?

 \ /
  Last update: 2009-04-24 00:53    [W:0.127 / U:26.620 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site