All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Mason <jdmason@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mulix@mulix.org, ak@suse.de
Subject: [PATCH] mm: add a nopanic option for low bootmem
Date: Mon, 24 Apr 2006 16:44:29 -0500	[thread overview]
Message-ID: <20060424214428.GA14575@us.ibm.com> (raw)

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;
+}

             reply	other threads:[~2006-04-24 21:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-24 21:44 Jon Mason [this message]
2006-04-24 22:43 ` [PATCH] mm: add a nopanic option for low bootmem Andi Kleen
2006-04-25  5:33   ` Muli Ben-Yehuda
2006-04-25 14:08   ` Jon Mason
2006-04-26 11:28     ` Andi Kleen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060424214428.GA14575@us.ibm.com \
    --to=jdmason@us.ibm.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mulix@mulix.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.