Patchwork sparc64: Use node local allocations for IRQ stacks.

login
register
mail settings
Submitter Sam Ravnborg
Date April 27, 2012, 6:29 p.m.
Message ID <20120427182935.GA5690@merkur.ravnborg.org>
Download mbox | patch
Permalink /patch/155567/
State RFC
Delegated to: David Miller
Headers show

Comments

Sam Ravnborg - April 27, 2012, 6:29 p.m.
On Fri, Apr 27, 2012 at 02:08:40PM -0400, David Miller wrote:
> From: Sam Ravnborg <sam@ravnborg.org>
> Date: Fri, 27 Apr 2012 19:58:16 +0200
> 
> > On Fri, Apr 27, 2012 at 01:34:07PM -0400, David Miller wrote:
> >> > Knowing that sparc64 just got converted to NO_BOOTMEM it
> >> > hurts my eyes to see memblock_alloc() be replaced
> >> > by __alloc_bootmem_node().
> >> 
> >> Since the stack allocations happen now (for the sake of setting
> >> up the NUMA mappings) after bootmem init, it's prudent to use
> >> the alloc_bootmem interfaces.
> > 
> > It was my understanding that everything provided by mm/nobootmem.c
> > is wrappers provided for backward compatibility with the old
> > bootmem based early allocator.
> > And that we later would make this file optional when.
> > 
> > But I seems to be wrong here.
> 
> Once the memblock functions provide NUMA node fallbacks and
> __va()/memset wrappers, we can certainly use memblock directly :-)

If I read the memblock code correct something like this should do it.
Only as a principal idea - I may revist this another time.

	Sam



> 
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - April 27, 2012, 6:36 p.m.
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 27 Apr 2012 20:29:35 +0200

> If I read the memblock code correct something like this should do it.
> Only as a principal idea - I may revist this another time.

The interface wrappers you come up with have to cope with all of the
generic bootmem calls we have in the tree.  And therefore you'll need
to provide limit, goal, and associated fallbacks.

Oh look, the alloc_bootmem wrappers already provide this and allow us
to not have to edit all the call sites at all.

So it seems quite useless if you ask me. :-)
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index a6bb102..3e8d102 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -148,6 +148,39 @@  phys_addr_t memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid)
 
 phys_addr_t memblock_alloc(phys_addr_t size, phys_addr_t align);
 
+static inline void * memblock_boot_alloc_nid(phys_addr_t size,
+					     phys_addr_t align, int nid)
+{
+	phys_addr_t addr;
+	void * ptr;
+
+	addr = memblock_boot_alloc_nid(size, align, nid);
+	if (addr == 0)
+		return NULL;
+
+	void * ptr = __va(addr);
+	memset(ptr, 0, size);
+	return ptr;
+}
+
+static inline void * memblock_boot_alloc_try_nid(phys_addr_t size,
+						 phys_addr_t align, int nid)
+{
+	phys_addr_t addr;
+	void * ptr;
+
+	addr = memblock_boot_alloc_try_nid(size, align, nid);
+	if (addr == 0)
+		return NULL;
+
+	ptr = __va(addr);
+	memset(ptr, 0, size);
+	return ptr;
+}
+
+void * memblock_boot_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid);
+void * memblock_boot_alloc(phys_addr_t size, phys_addr_t align);
+
 /* Flags for memblock_alloc_base() amd __memblock_alloc_base() */
 #define MEMBLOCK_ALLOC_ANYWHERE	(~(phys_addr_t)0)
 #define MEMBLOCK_ALLOC_ACCESSIBLE	0