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

From: Johannes Weiner
Date: Thu Apr 07 2011 - 20:19:58 EST


On Thu, Apr 07, 2011 at 10:23:02AM -0700, Dave Hansen wrote:
> Signed-off-by: Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>

I agree with this in general, but have some nitpicks.

> @@ -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.

> + /*
> + * 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?

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