LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH 24/25] lmb: Make lmb_alloc_try_nid() fallback to LMB_ALLOC_ANYWHERE
       [not found]                                           ` <1273484765-29055-23-git-send-email-benh@kernel.crashing.org>
@ 2010-05-10  9:46                                             ` Benjamin Herrenschmidt
  2010-05-10  9:46                                               ` [PATCH 25/25] lmb: Add debugfs files to dump the arrays content Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2010-05-10  9:46 UTC (permalink / raw
  To: linux-mm; +Cc: linux-kernel, tglx, mingo, davem, lethal, Benjamin Herrenschmidt

lmb_alloc_nid() used to fallback to allocating anywhere by using
lmb_alloc() as a fallback.

However, some of my previous patches limit lmb_alloc() to the region
covered by LMB_ALLOC_ACCESSIBLE which is not quite what we want
for lmb_alloc_try_nid().

So we fix it by explicitely using LMB_ALLOC_ANYWHERE.

Not that so far only sparc uses lmb_alloc_nid() and it hasn't been updated
to clamp the accessible zone yet. Thus the temporary "breakage" should have
no effect.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 lib/lmb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index fd98261..6c38c87 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -531,7 +531,7 @@ phys_addr_t __init lmb_alloc_try_nid(phys_addr_t size, phys_addr_t align, int ni
 
 	if (res)
 		return res;
-	return lmb_alloc(size, align);
+	return lmb_alloc_base(size, align, LMB_ALLOC_ANYWHERE);
 }
 
 
-- 
1.6.3.3


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

* [PATCH 25/25] lmb: Add debugfs files to dump the arrays content
  2010-05-10  9:46                                             ` [PATCH 24/25] lmb: Make lmb_alloc_try_nid() fallback to LMB_ALLOC_ANYWHERE Benjamin Herrenschmidt
@ 2010-05-10  9:46                                               ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2010-05-10  9:46 UTC (permalink / raw
  To: linux-mm; +Cc: linux-kernel, tglx, mingo, davem, lethal, Benjamin Herrenschmidt

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 lib/lmb.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/lib/lmb.c b/lib/lmb.c
index 6c38c87..1e11891 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -16,6 +16,8 @@
 #include <linux/bitops.h>
 #include <linux/poison.h>
 #include <linux/pfn.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
 #include <linux/lmb.h>
 
 struct lmb lmb;
@@ -696,3 +698,52 @@ static int __init early_lmb(char *p)
 }
 early_param("lmb", early_lmb);
 
+#ifdef CONFIG_DEBUG_FS
+
+static int lmb_debug_show(struct seq_file *m, void *private)
+{
+	struct lmb_type *type = m->private;
+	struct lmb_region *reg;
+	int i;
+
+	for (i = 0; i < type->cnt; i++) {
+		reg = &type->regions[i];
+		seq_printf(m, "%4d: ", i);
+		if (sizeof(phys_addr_t) == 4)
+			seq_printf(m, "0x%08lx..0x%08lx\n",
+				   (unsigned long)reg->base,
+				   (unsigned long)(reg->base + reg->size - 1));
+		else
+			seq_printf(m, "0x%016llx..0x%016llx\n",
+				   (unsigned long long)reg->base,
+				   (unsigned long long)(reg->base + reg->size - 1));
+
+	}
+	return 0;
+}
+
+static int lmb_debug_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, lmb_debug_show, inode->i_private);
+}
+
+static const struct file_operations lmb_debug_fops = {
+	.open = lmb_debug_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
+};
+
+static int __init lmb_init_debugfs(void)
+{
+	struct dentry *root = debugfs_create_dir("lmb", NULL);
+	if (!root)
+		return -ENXIO;
+	debugfs_create_file("memory", S_IRUGO, root, &lmb.memory, &lmb_debug_fops);
+	debugfs_create_file("reserved", S_IRUGO, root, &lmb.reserved, &lmb_debug_fops);
+	
+	return 0;
+}
+__initcall(lmb_init_debugfs);
+
+#endif /* CONFIG_DEBUG_FS */
-- 
1.6.3.3


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

end of thread, other threads:[~2010-05-10  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1273484765-29055-1-git-send-email-benh@kernel.crashing.org>
     [not found] ` <1273484765-29055-2-git-send-email-benh@kernel.crashing.org>
     [not found]   ` <1273484765-29055-3-git-send-email-benh@kernel.crashing.org>
     [not found]     ` <1273484765-29055-4-git-send-email-benh@kernel.crashing.org>
     [not found]       ` <1273484765-29055-5-git-send-email-benh@kernel.crashing.org>
     [not found]         ` <1273484765-29055-6-git-send-email-benh@kernel.crashing.org>
     [not found]           ` <1273484765-29055-7-git-send-email-benh@kernel.crashing.org>
     [not found]             ` <1273484765-29055-8-git-send-email-benh@kernel.crashing.org>
     [not found]               ` <1273484765-29055-9-git-send-email-benh@kernel.crashing.org>
     [not found]                 ` <1273484765-29055-10-git-send-email-benh@kernel.crashing.org>
     [not found]                   ` <1273484765-29055-11-git-send-email-benh@kernel.crashing.org>
     [not found]                     ` <1273484765-29055-12-git-send-email-benh@kernel.crashing.org>
     [not found]                       ` <1273484765-29055-13-git-send-email-benh@kernel.crashing.org>
     [not found]                         ` <1273484765-29055-14-git-send-email-benh@kernel.crashing.org>
     [not found]                           ` <1273484765-29055-15-git-send-email-benh@kernel.crashing.org>
     [not found]                             ` <1273484765-29055-16-git-send-email-benh@kernel.crashing.org>
     [not found]                               ` <1273484765-29055-17-git-send-email-benh@kernel.crashing.org>
     [not found]                                 ` <1273484765-29055-18-git-send-email-benh@kernel.crashing.org>
     [not found]                                   ` <1273484765-29055-19-git-send-email-benh@kernel.crashing.org>
     [not found]                                     ` <1273484765-29055-20-git-send-email-benh@kernel.crashing.org>
     [not found]                                       ` <1273484765-29055-21-git-send-email-benh@kernel.crashing.org>
     [not found]                                         ` <1273484765-29055-22-git-send-email-benh@kernel.crashing.org>
     [not found]                                           ` <1273484765-29055-23-git-send-email-benh@kernel.crashing.org>
2010-05-10  9:46                                             ` [PATCH 24/25] lmb: Make lmb_alloc_try_nid() fallback to LMB_ALLOC_ANYWHERE Benjamin Herrenschmidt
2010-05-10  9:46                                               ` [PATCH 25/25] lmb: Add debugfs files to dump the arrays content Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).