linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: mel@skynet.ie (Mel Gorman)
To: Andrew Morton <akpm@linux-foundation.org>
Cc: bob.picco@hp.com, apw@shadowen.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix corruption of memmap on IA64 SPARSEMEM when mem_section is not a power of 2
Date: Wed, 25 Jul 2007 15:49:44 +0100	[thread overview]
Message-ID: <20070725144944.GD32445@skynet.ie> (raw)
In-Reply-To: <20070724220116.0d9fb8b5.akpm@linux-foundation.org>

On (24/07/07 22:01), Andrew Morton didst pronounce:
> On Tue, 13 Mar 2007 10:42:02 +0000 mel@skynet.ie (Mel Gorman) wrote:
> 
> > There are problems in the use of SPARSEMEM and pageblock flags that causes
> > problems on ia64.
> > 
> > <SNIP>
> 
> SuperH allmodconfig blew up:
> 
> mm/sparse.c: In function `sparse_init':
> mm/sparse.c:482: error: implicit declaration of function `sparse_early_usemap_alloc'
> mm/sparse.c:482: warning: assignment makes pointer from integer without a cast
> mm/sparse.c: In function `sparse_add_one_section':
> mm/sparse.c:553: error: implicit declaration of function `__kmalloc_section_usemap'
> mm/sparse.c:553: warning: assignment makes pointer from integer without a cast

This error is due to a bad interaction between
generic-virtual-memmap-support-for-sparsemem.patch and
fix-corruption-of-memmap-on-ia64-sparsemem-when-mem_section-is-not-a-power-of-2.patch
. Functions that are needed whether CONFIG_SPARSEMEM_VMEMMAP is set are
not are depending on CONFIG_SPARSEMEM_VMEMMAP . This breaks on arch/sh
for example where SPARSEMEM may be set but not NUMA.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>

---
 sparse.c |   58 +++++++++++++++++++++++++++++-----------------------------
 1 file changed, 29 insertions(+), 29 deletions(-)


diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.23-rc1-mm1-clean/mm/sparse.c linux-2.6.23-rc1-mm1-005-sh-sparsemem-fix/mm/sparse.c
--- linux-2.6.23-rc1-mm1-clean/mm/sparse.c	2007-07-25 13:43:30.000000000 +0100
+++ linux-2.6.23-rc1-mm1-005-sh-sparsemem-fix/mm/sparse.c	2007-07-25 14:27:58.000000000 +0100
@@ -220,6 +220,35 @@ void *alloc_bootmem_high_node(pg_data_t 
 	return NULL;
 }
 
+static unsigned long usemap_size(void)
+{
+	unsigned long size_bytes;
+	size_bytes = roundup(SECTION_BLOCKFLAGS_BITS, 8) / 8;
+	size_bytes = roundup(size_bytes, sizeof(unsigned long));
+	return size_bytes;
+}
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+static unsigned long *__kmalloc_section_usemap(void)
+{
+	return kmalloc(usemap_size(), GFP_KERNEL);
+}
+#endif /* CONFIG_MEMORY_HOTPLUG */
+
+static unsigned long *sparse_early_usemap_alloc(unsigned long pnum)
+{
+	unsigned long *usemap;
+	struct mem_section *ms = __nr_to_section(pnum);
+	int nid = sparse_early_nid(ms);
+
+	usemap = alloc_bootmem_node(NODE_DATA(nid), usemap_size());
+	if (usemap)
+		return usemap;
+
+	printk(KERN_WARNING "%s: allocation failed\n", __FUNCTION__);
+	return NULL;
+}
+
 #ifdef CONFIG_SPARSEMEM_VMEMMAP
 /*
  * Virtual Memory Map support
@@ -254,35 +283,6 @@ void *alloc_bootmem_high_node(pg_data_t 
  * 	require one PTE/TLB per PAGE_SIZE chunk of the virtual memory map.
  */
 
-static unsigned long usemap_size(void)
-{
-	unsigned long size_bytes;
- 	size_bytes = roundup(SECTION_BLOCKFLAGS_BITS, 8) / 8;
-	size_bytes = roundup(size_bytes, sizeof(unsigned long));
-	return size_bytes;
-}
-
-#ifdef CONFIG_MEMORY_HOTPLUG
-static unsigned long *__kmalloc_section_usemap(void)
-{
-	return kmalloc(usemap_size(), GFP_KERNEL);
-}
-#endif /* CONFIG_MEMORY_HOTPLUG */
-
-static unsigned long *sparse_early_usemap_alloc(unsigned long pnum)
-{
-	unsigned long *usemap;
-	struct mem_section *ms = __nr_to_section(pnum);
-	int nid = sparse_early_nid(ms);
-
-	usemap = alloc_bootmem_node(NODE_DATA(nid), usemap_size());
-	if (usemap)
-		return usemap;
-
-	printk(KERN_WARNING "%s: allocation failed\n", __FUNCTION__);
-	return NULL;
-}
-
 /*
  * Allocate a block of memory to be used to back the virtual memory map
  * or to back the page tables that are used to create the mapping.
-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

  parent reply	other threads:[~2007-07-25 14:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-13 10:42 [PATCH] Fix corruption of memmap on IA64 SPARSEMEM when mem_section is not a power of 2 Mel Gorman
2007-07-25  5:01 ` Andrew Morton
2007-07-25 12:55   ` Mel Gorman
2007-07-25 20:10     ` Andrew Morton
2007-07-25 14:49   ` Mel Gorman [this message]
2007-07-25 14:53     ` Mel Gorman
2007-07-25 16:25     ` Andy Whitcroft

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=20070725144944.GD32445@skynet.ie \
    --to=mel@skynet.ie \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=bob.picco@hp.com \
    --cc=linux-kernel@vger.kernel.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 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 NNTP newsgroup(s).