Re: [PATCH] print vmalloc() state after allocation failures

From: Dave Hansen
Date: Fri Apr 08 2011 - 09:23:24 EST


On Thu, 2011-04-07 at 17:19 -0700, Johannes Weiner wrote:
> On Thu, Apr 07, 2011 at 10:23:02AM -0700, Dave Hansen wrote:
> > @@ -1579,6 +1579,18 @@ static void *__vmalloc_area_node(struct
> > return area->addr;
> >
> > fail:
> > + if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit()) {
>
> There is a comment above the declaration of printk_ratelimit:
>
> /*
> * Please don't use printk_ratelimit(), because it shares ratelimiting state
> * with all other unrelated printk_ratelimit() callsites. Instead use
> * printk_ratelimited() or plain old __ratelimit().
> */
>
> I realize that the page allocator does it the same way, but I think it
> should probably be fixed in there, rather than spread any further.

You're the second person to mention this. I should have listened the
first time. :) I'll fix it up and repost.

> > + /*
> > + * We probably did a show_mem() and a stack dump above
> > + * inside of alloc_page*(). This is only so we can
> > + * tell how big the vmalloc() really was. This will
> > + * also not be exactly the same as what was passed
> > + * to vmalloc() due to alignment and the guard page.
> > + */
> > + printk(KERN_WARNING "%s: vmalloc: allocation failure, "
> > + "allocated %ld of %ld bytes\n", current->comm,
> > + (area->nr_pages*PAGE_SIZE), area->size);
> > + }
>
> To me, this does not look like something that should just be appended
> to the whole pile spewed out by dump_stack() and show_mem(). What do
> you think about doing the page allocation with __GFP_NOWARN and have
> the full report come from this place, with the line you introduce as
> leader?

That sounds fine to me.

-- Dave

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