lkml.org 
[lkml]   [2004]   [Nov]   [24]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectSuspend 2 merge: 30/51: Enable slab alloc fallback to suspend memory pool
FromNigel Cunningham <>
DateWed, 24 Nov 2004 23:59:45 +1100
When we are preparing the image and have eaten all available memory, but
before page allocations have been switched over to the memory pool, we
sometimes need to allocate memory from slab for the image metadata (swap
header information). This code allows the slab allocator to fall back to
the memory pool in such circumstances. There is some extra debugging
code there at the moment while I seek to diagnose intermittent slab
corruption (not sure if it's suspend related).

diff -ruN 817-enable-slab-alloc-fallback-to-suspend-memory-pool-old/mm/slab.c 817-enable-slab-alloc-fallback-to-suspend-memory-pool-new/mm/slab.c
--- 817-enable-slab-alloc-fallback-to-suspend-memory-pool-old/mm/slab.c 2004-11-24 15:48:55.066733152 +1100
+++ 817-enable-slab-alloc-fallback-to-suspend-memory-pool-new/mm/slab.c 2004-11-23 07:11:42.000000000 +1100
@@ -874,14 +874,30 @@
flags |= cachep->gfpflags;
if (likely(nodeid == -1)) {
addr = (void*)__get_free_pages(flags, cachep->gfporder);
+ if (unlikely((!addr) && (current->pid == suspend_task) &&
+ test_suspend_state(SUSPEND_SLAB_ALLOC_FALLBACK))) {
+ addr = (void *) suspend2_get_grabbed_pages(0);
+ printk("!! Slab addition satisfied via fallback code.\n");
+ }
if (!addr)
return NULL;
+ if (unlikely(test_suspend_state(SUSPEND_RUNNING)))
+ printk("Order %d allocation %p added to slab %p.\n",
+ cachep->gfporder, addr, cachep);
page = virt_to_page(addr);
} else {
page = alloc_pages_node(nodeid, flags, cachep->gfporder);
+ if (unlikely((!page) && (current->pid == suspend_task) &&
+ test_suspend_state(SUSPEND_SLAB_ALLOC_FALLBACK))) {
+ page = virt_to_page(suspend2_get_grabbed_pages(0));
+ printk("!! Slab addition satisfied via fallback code.\n");
+ }
if (!page)
return NULL;
addr = page_address(page);
+ if (unlikely(test_suspend_state(SUSPEND_RUNNING)))
+ printk("Order %d allocation %p added to slab %p.\n",
+ cachep->gfporder, addr, cachep);
}

i = (1 << cachep->gfporder);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [from the cache]
©2003-2009