linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory()
@ 2012-05-07 19:32 Russ Anderson
  2012-05-07 21:32 ` Andrew Morton
  2012-05-08 20:16 ` Yinghai Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Russ Anderson @ 2012-05-07 19:32 UTC (permalink / raw)
  To: linux-kernel, linux-mm, Yinghai Lu, David Miller; +Cc: Russ Anderson

Systems with 8 TBytes of memory or greater can hit a problem 
where only the the first 8 TB of memory shows up.  This is
due to "int i" being smaller than "unsigned long start_aligned",
causing the high bits to be dropped.

The fix is to change i to unsigned long to match start_aligned
and end_aligned.

Thanks to Jack Steiner (steiner@sgi.com) for assistance tracking
this down.

Signed-off-by: Russ Anderson <rja@sgi.com>

---
 mm/nobootmem.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: linux/mm/nobootmem.c
===================================================================
--- linux.orig/mm/nobootmem.c	2012-05-05 08:39:39.470845187 -0500
+++ linux/mm/nobootmem.c	2012-05-05 08:39:42.714784530 -0500
@@ -82,8 +82,7 @@ void __init free_bootmem_late(unsigned l
 
 static void __init __free_pages_memory(unsigned long start, unsigned long end)
 {
-	int i;
-	unsigned long start_aligned, end_aligned;
+	unsigned long i, start_aligned, end_aligned;
 	int order = ilog2(BITS_PER_LONG);
 
 	start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1);
-- 
Russ Anderson, OS RAS/Partitioning Project Lead  
SGI - Silicon Graphics Inc          rja@sgi.com

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

* Re: [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory()
  2012-05-07 19:32 [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory() Russ Anderson
@ 2012-05-07 21:32 ` Andrew Morton
  2012-05-08 20:16 ` Yinghai Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2012-05-07 21:32 UTC (permalink / raw)
  To: Russ Anderson; +Cc: linux-kernel, linux-mm, Yinghai Lu, David Miller

On Mon, 7 May 2012 14:32:03 -0500
Russ Anderson <rja@sgi.com> wrote:

> Systems with 8 TBytes of memory or greater can hit a problem 
> where only the the first 8 TB of memory shows up.

erk.

>  This is
> due to "int i" being smaller than "unsigned long start_aligned",
> causing the high bits to be dropped.
> 
> The fix is to change i to unsigned long to match start_aligned
> and end_aligned.
> 
> Thanks to Jack Steiner (steiner@sgi.com) for assistance tracking
> this down.
> 

I added the Cc: <stable@vger.kernel.org> to this.  The fix is small and
safe and someone might want to run older kernels on such a machine.


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

* Re: [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory()
  2012-05-07 19:32 [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory() Russ Anderson
  2012-05-07 21:32 ` Andrew Morton
@ 2012-05-08 20:16 ` Yinghai Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2012-05-08 20:16 UTC (permalink / raw)
  To: Russ Anderson; +Cc: linux-kernel, linux-mm, David Miller

On Mon, May 7, 2012 at 12:32 PM, Russ Anderson <rja@sgi.com> wrote:
> Systems with 8 TBytes of memory or greater can hit a problem
> where only the the first 8 TB of memory shows up.  This is
> due to "int i" being smaller than "unsigned long start_aligned",
> causing the high bits to be dropped.

when you have 8T installed, you should get [0,2g), [4g, 8T+2g)

if you have more than that. [2g, 4g) could be added as ram together
with MMIO....

>
> The fix is to change i to unsigned long to match start_aligned
> and end_aligned.
>
> Thanks to Jack Steiner (steiner@sgi.com) for assistance tracking
> this down.
>
> Signed-off-by: Russ Anderson <rja@sgi.com>
>
> ---
>  mm/nobootmem.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> Index: linux/mm/nobootmem.c
> ===================================================================
> --- linux.orig/mm/nobootmem.c   2012-05-05 08:39:39.470845187 -0500
> +++ linux/mm/nobootmem.c        2012-05-05 08:39:42.714784530 -0500
> @@ -82,8 +82,7 @@ void __init free_bootmem_late(unsigned l
>
>  static void __init __free_pages_memory(unsigned long start, unsigned long end)
>  {
> -       int i;
> -       unsigned long start_aligned, end_aligned;
> +       unsigned long i, start_aligned, end_aligned;
>        int order = ilog2(BITS_PER_LONG);
>
>        start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1);

Acked-by: Yinghai Lu <yinghai@kernel.org>

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

end of thread, other threads:[~2012-05-08 20:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 19:32 [patch] mm: nobootmem: fix sign extend problem in __free_pages_memory() Russ Anderson
2012-05-07 21:32 ` Andrew Morton
2012-05-08 20:16 ` Yinghai Lu

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).