* [PATCH] MM: Fix NR_SECTION_ROOTS == 0 when using using sparsemem extreme.
@ 2010-05-05 21:02 Marcelo Roberto Jimenez
2010-05-05 22:19 ` Marcelo Jimenez
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Roberto Jimenez @ 2010-05-05 21:02 UTC (permalink / raw)
To: mroberto, Andrew Morton, KOSAKI Motohiro, Christoph Lameter,
Mel Gorman, Minchan Kim, Russell King - ARM Linux,
Stephen Rothwell, H. Peter Anvin, Yinghai Lu, Sergei Shtylyov
Cc: linux-kernel, linux-mm
Got this while compiling for ARM/SA1100:
mm/sparse.c: In function '__section_nr':
mm/sparse.c:135: warning: 'root' is used uninitialized in this function
This patch follows Russell King's suggestion for a new calculation for
NR_SECTION_ROOTS. Thanks also to Sergei Shtylyov for pointing out the
existence of the macro DIV_ROUND_UP.
Signed-off-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
---
include/linux/mmzone.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index cf9e458..e90ad64 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -972,7 +972,7 @@ struct mem_section {
#endif
#define SECTION_NR_TO_ROOT(sec) ((sec) / SECTIONS_PER_ROOT)
-#define NR_SECTION_ROOTS (NR_MEM_SECTIONS / SECTIONS_PER_ROOT)
+#define NR_SECTION_ROOTS DIV_ROUND_UP(NR_MEM_SECTIONS, SECTIONS_PER_ROOT)
#define SECTION_ROOT_MASK (SECTIONS_PER_ROOT - 1)
#ifdef CONFIG_SPARSEMEM_EXTREME
--
1.7.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MM: Fix NR_SECTION_ROOTS == 0 when using using sparsemem extreme.
2010-05-05 21:02 [PATCH] MM: Fix NR_SECTION_ROOTS == 0 when using using sparsemem extreme Marcelo Roberto Jimenez
@ 2010-05-05 22:19 ` Marcelo Jimenez
2010-05-19 16:14 ` Atsushi Nemoto
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Jimenez @ 2010-05-05 22:19 UTC (permalink / raw)
To: mroberto, Andrew Morton, KOSAKI Motohiro, Christoph Lameter
Cc: linux-kernel, linux-mm
I have done a limited test of the patch, I don't think the actual code
has been reached, any help would be appreciated.
I did a small patch to /proc/meminfo to check that NR_SECTION_ROOTS is
now non-zero:
$ cat /proc/meminfo
NR_SECTION_ROOTS=1
NR_MEM_SECTIONS=32
SECTIONS_PER_ROOT=512
SECTIONS_SHIFT=5
MAX_PHYSMEM_BITS=32
SECTION_SIZE_BITS=27
...
On Wed, May 5, 2010 at 18:02, Marcelo Roberto Jimenez
<mroberto@cpti.cetuc.puc-rio.br> wrote:
> Got this while compiling for ARM/SA1100:
>
> mm/sparse.c: In function '__section_nr':
> mm/sparse.c:135: warning: 'root' is used uninitialized in this function
>
> This patch follows Russell King's suggestion for a new calculation for
> NR_SECTION_ROOTS. Thanks also to Sergei Shtylyov for pointing out the
> existence of the macro DIV_ROUND_UP.
>
> Signed-off-by: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] MM: Fix NR_SECTION_ROOTS == 0 when using using sparsemem extreme.
2010-05-05 22:19 ` Marcelo Jimenez
@ 2010-05-19 16:14 ` Atsushi Nemoto
0 siblings, 0 replies; 3+ messages in thread
From: Atsushi Nemoto @ 2010-05-19 16:14 UTC (permalink / raw)
To: mroberto
Cc: akpm, kosaki.motohiro, cl, mel, minchan.kim, linux, sfr, hpa,
yinghai, sshtylyov, linux-kernel, linux-mm
On Wed, 5 May 2010 18:02:46 -0300, Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> wrote:
> Got this while compiling for ARM/SA1100:
>
> mm/sparse.c: In function '__section_nr':
> mm/sparse.c:135: warning: 'root' is used uninitialized in this function
>
> This patch follows Russell King's suggestion for a new calculation for
> NR_SECTION_ROOTS. Thanks also to Sergei Shtylyov for pointing out the
> existence of the macro DIV_ROUND_UP.
JFYI, This fix is not just silence the warning, fix a real problem.
Without this fix, mem_section[] might have 0 size so mem_section[0]
will share other variable area. For example, I got:
c030c700 b __warned.16478
c030c700 B mem_section
c030c701 b __warned.16483
This might cause very strange behavior. Your patch actually fixes it.
Thank you.
---
Atsushi Nemoto
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-19 16:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-05 21:02 [PATCH] MM: Fix NR_SECTION_ROOTS == 0 when using using sparsemem extreme Marcelo Roberto Jimenez
2010-05-05 22:19 ` Marcelo Jimenez
2010-05-19 16:14 ` Atsushi Nemoto
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).