Commit 63b060c4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] page_alloc failure printk

Emit a printk when a page allocation fails.  Considered useful for
diagnosing crashes.
parent 85d217f4
...@@ -394,12 +394,15 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_ ...@@ -394,12 +394,15 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_
if (page) if (page)
return page; return page;
} }
nopage:
printk("%s: page allocation failure. order:%d, mode:0x%x\n",
current->comm, order, gfp_mask);
return NULL; return NULL;
} }
/* Atomic allocations - we can't balance anything */ /* Atomic allocations - we can't balance anything */
if (!(gfp_mask & __GFP_WAIT)) if (!(gfp_mask & __GFP_WAIT))
return NULL; goto nopage;
page = balance_classzone(classzone, gfp_mask, order, &freed); page = balance_classzone(classzone, gfp_mask, order, &freed);
if (page) if (page)
...@@ -422,7 +425,7 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_ ...@@ -422,7 +425,7 @@ struct page * __alloc_pages(unsigned int gfp_mask, unsigned int order, zonelist_
/* Don't let big-order allocations loop */ /* Don't let big-order allocations loop */
if (order > 3) if (order > 3)
return NULL; goto nopage;
/* Yield for kswapd, and try again */ /* Yield for kswapd, and try again */
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment