mm: add a nopanic option for low bootmem
PATCH 1/1 mm: add a nopanic option for low bootmem
This patch adds a no panic option for low bootmem allocs. This will allow for a more graceful handling of "out of memory" for those callers who wish to handle it.
Thanks,
Jon
include/linux/bootmem.h +1 -0
@@ -46,6 +46,7 @@extern void __init free_bootmem (unsigned long addr,unsigned long size);extern void *__init __alloc_bootmem (unsigned long size,unsigned long align,unsigned long goal);extern void *__init __alloc_bootmem_nopanic (unsigned long size,unsigned long align,unsigned long goal); +extern void *__init __alloc_bootmem_low_nopanic (unsigned long size,unsigned long align,unsigned long goal);extern void *__init __alloc_bootmem_low (unsigned long size,unsigned long align,unsigned long goal);
mm/bootmem.c +13 -0
@@ -463,3 +463,16 @@ {return __alloc_bootmem_core (pgdat->bdata, size, align, goal,LOW32LIMIT ); } + +void *__init __alloc_bootmem_low_nopanic (unsigned long size, +unsigned long align,unsigned long goal) +{ +bootmem_data_t *bdata; +void *ptr; + +list_for_each_entry (bdata, &bdata_list, list) +if ((ptr =__alloc_bootmem_core (bdata, size, align, goal, +LOW32LIMIT ))) +return (ptr); +return NULL ; +}
Quoted 3 lines · Jon Mason
This patch adds a no panic option for low bootmem allocs. This will allow for a more graceful handling of "out of memory" for those callers who wish to handle it.
What's the user of it? Normally we don't merge such changes without an user.
-Andi
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Jon Mason
This patch adds a no panic option for low bootmem allocs. This will allow for a more graceful handling of "out of memory" for those callers who wish to handle it.
What's the user of it? Normally we don't merge such changes without an user.
Calgary and swiotlb can use it to gracefully handle out of memory when they allocate their aperture (swiotlb) or translation tables (Calgary) on initialization. Either can fall back to no-iommu if initialization fails so there's really no need to panic.
Jon, you should probably resubmit this with your swiotlb patches making use of it.
Cheers,
Muli
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Jon Mason
This patch adds a no panic option for low bootmem allocs. This will allow for a more graceful handling of "out of memory" for those callers who wish to handle it.
What's the user of it? Normally we don't merge such changes without an user.
Sorry. Per your suggestion in the review of our Calgary IOMMU code, I tried to use the alloc_bootmem_nopanic that you recently added. Unfortunately, it needs low mem for our translation tables, so we needed a new function to do this.
Aside from Calgary, I have updated swiotlb to take advantage of this new function (amongst other clean-ups and refinements). I'll push those swiotlb patches out today.
Thanks,
Jon
Quoted 2 lines
-Andi
Quoted 9 lines · Jon Mason
Quoted 7 lines · Andi Kleen
Quoted 3 lines · Jon Mason
This patch adds a no panic option for low bootmem allocs. This will allow for a more graceful handling of "out of memory" for those callers who wish to handle it.
What's the user of it? Normally we don't merge such changes without an user.
Quoted 8 lines
Sorry. Per your suggestion in the review of our Calgary IOMMU code, I tried to use the
alloc_bootmem_nopanicthat you recently added. Unfortunately, it needs low mem for our translation tables, so we needed a new function to do this.Aside from Calgary, I have updated swiotlb to take advantage of this new function (amongst other clean-ups and refinements). I'll push those swiotlb patches out today.
I will merge it together with the Calgary code then. -Andi