public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: add a nopanic option for low bootmem
@ 2006-04-24 21:44 Jon Mason
  2006-04-24 22:43 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Mason @ 2006-04-24 21:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: mulix, ak

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

Signed-off-by: Jon Mason <jdmason@us.ibm.com>

diff -r 307c5ac10c26 include/linux/bootmem.h
--- a/include/linux/bootmem.h	Sat Apr 22 12:21:45 2006
+++ b/include/linux/bootmem.h	Mon Apr 24 09:59:50 2006
@@ -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);
diff -r 307c5ac10c26 mm/bootmem.c
--- a/mm/bootmem.c	Sat Apr 22 12:21:45 2006
+++ b/mm/bootmem.c	Mon Apr 24 09:59:50 2006
@@ -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;
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add a nopanic option for low bootmem
  2006-04-24 21:44 [PATCH] mm: add a nopanic option for low bootmem Jon Mason
@ 2006-04-24 22:43 ` Andi Kleen
  2006-04-25  5:33   ` Muli Ben-Yehuda
  2006-04-25 14:08   ` Jon Mason
  0 siblings, 2 replies; 5+ messages in thread
From: Andi Kleen @ 2006-04-24 22:43 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, mulix

On Monday 24 April 2006 23:44, Jon Mason wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add a nopanic option for low bootmem
  2006-04-24 22:43 ` Andi Kleen
@ 2006-04-25  5:33   ` Muli Ben-Yehuda
  2006-04-25 14:08   ` Jon Mason
  1 sibling, 0 replies; 5+ messages in thread
From: Muli Ben-Yehuda @ 2006-04-25  5:33 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Jon Mason, linux-kernel, muli

On Tue, Apr 25, 2006 at 12:43:38AM +0200, Andi Kleen wrote:
> On Monday 24 April 2006 23:44, Jon Mason wrote:
> > 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
-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add a nopanic option for low bootmem
  2006-04-24 22:43 ` Andi Kleen
  2006-04-25  5:33   ` Muli Ben-Yehuda
@ 2006-04-25 14:08   ` Jon Mason
  2006-04-26 11:28     ` Andi Kleen
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Mason @ 2006-04-25 14:08 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, mulix

On Tue, Apr 25, 2006 at 12:43:38AM +0200, Andi Kleen wrote:
> On Monday 24 April 2006 23:44, Jon Mason wrote:
> > 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

> 
> -Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm: add a nopanic option for low bootmem
  2006-04-25 14:08   ` Jon Mason
@ 2006-04-26 11:28     ` Andi Kleen
  0 siblings, 0 replies; 5+ messages in thread
From: Andi Kleen @ 2006-04-26 11:28 UTC (permalink / raw)
  To: Jon Mason; +Cc: linux-kernel, mulix

On Tuesday 25 April 2006 16:08, Jon Mason wrote:
> On Tue, Apr 25, 2006 at 12:43:38AM +0200, Andi Kleen wrote:
> > On Monday 24 April 2006 23:44, Jon Mason wrote:
> > > 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.


I will merge it together with the Calgary code then.
-Andi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-26 11:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-24 21:44 [PATCH] mm: add a nopanic option for low bootmem Jon Mason
2006-04-24 22:43 ` Andi Kleen
2006-04-25  5:33   ` Muli Ben-Yehuda
2006-04-25 14:08   ` Jon Mason
2006-04-26 11:28     ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox