All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix handling of pagesets for downed cpus
@ 2009-06-22 18:24 Dimitri Sivanich
  2009-06-23 10:40 ` KOSAKI Motohiro
  0 siblings, 1 reply; 2+ messages in thread
From: Dimitri Sivanich @ 2009-06-22 18:24 UTC (permalink / raw)
  To: akpm, linux-kernel; +Cc: cl, kosaki.motohiro, mel, nickpiggin, stable

After downing/upping a cpu, an attempt to set
/proc/sys/vm/percpu_pagelist_fraction results in an oops in
percpu_pagelist_fraction_sysctl_handler().

If a processor is downed then we need to set the pageset pointer back to the
boot pageset.

Updates of the high water marks should not access pagesets of unpopulated zones
(those pointer go to the boot pagesets which would be no longer functional if
their size would be increased beyond zero).

Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---

This patch should go into the -stable tree as well.

 mm/page_alloc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c	2009-06-22 13:06:50.000000000 -0500
+++ linux/mm/page_alloc.c	2009-06-22 13:08:09.000000000 -0500
@@ -3026,7 +3026,7 @@ bad:
 		if (dzone == zone)
 			break;
 		kfree(zone_pcp(dzone, cpu));
-		zone_pcp(dzone, cpu) = NULL;
+		zone_pcp(dzone, cpu) = &boot_pageset[cpu];
 	}
 	return -ENOMEM;
 }
@@ -3041,7 +3041,7 @@ static inline void free_zone_pagesets(in
 		/* Free per_cpu_pageset if it is slab allocated */
 		if (pset != &boot_pageset[cpu])
 			kfree(pset);
-		zone_pcp(zone, cpu) = NULL;
+		zone_pcp(zone, cpu) = &boot_pageset[cpu];
 	}
 }
 
@@ -4659,7 +4659,7 @@ int percpu_pagelist_fraction_sysctl_hand
 	ret = proc_dointvec_minmax(table, write, file, buffer, length, ppos);
 	if (!write || (ret == -EINVAL))
 		return ret;
-	for_each_zone(zone) {
+	for_each_populated_zone(zone) {
 		for_each_online_cpu(cpu) {
 			unsigned long  high;
 			high = zone->present_pages / percpu_pagelist_fraction;

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

* Re: [PATCH] Fix handling of pagesets for downed cpus
  2009-06-22 18:24 [PATCH] Fix handling of pagesets for downed cpus Dimitri Sivanich
@ 2009-06-23 10:40 ` KOSAKI Motohiro
  0 siblings, 0 replies; 2+ messages in thread
From: KOSAKI Motohiro @ 2009-06-23 10:40 UTC (permalink / raw)
  To: Dimitri Sivanich
  Cc: kosaki.motohiro, akpm, linux-kernel, cl, mel, nickpiggin, stable

> After downing/upping a cpu, an attempt to set
> /proc/sys/vm/percpu_pagelist_fraction results in an oops in
> percpu_pagelist_fraction_sysctl_handler().
> 
> If a processor is downed then we need to set the pageset pointer back to the
> boot pageset.
> 
> Updates of the high water marks should not access pagesets of unpopulated zones
> (those pointer go to the boot pagesets which would be no longer functional if
> their size would be increased beyond zero).
> 
> Signed-off-by: Dimitri Sivanich <sivanich@sgi.com>
> Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
> 
> ---
> 
> This patch should go into the -stable tree as well.
> 
>  mm/page_alloc.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> Index: linux/mm/page_alloc.c
> ===================================================================
> --- linux.orig/mm/page_alloc.c	2009-06-22 13:06:50.000000000 -0500
> +++ linux/mm/page_alloc.c	2009-06-22 13:08:09.000000000 -0500
> @@ -3026,7 +3026,7 @@ bad:
>  		if (dzone == zone)
>  			break;
>  		kfree(zone_pcp(dzone, cpu));
> -		zone_pcp(dzone, cpu) = NULL;
> +		zone_pcp(dzone, cpu) = &boot_pageset[cpu];
>  	}
>  	return -ENOMEM;
>  }
> @@ -3041,7 +3041,7 @@ static inline void free_zone_pagesets(in
>  		/* Free per_cpu_pageset if it is slab allocated */
>  		if (pset != &boot_pageset[cpu])
>  			kfree(pset);
> -		zone_pcp(zone, cpu) = NULL;
> +		zone_pcp(zone, cpu) = &boot_pageset[cpu];
>  	}
>  }
>  
> @@ -4659,7 +4659,7 @@ int percpu_pagelist_fraction_sysctl_hand
>  	ret = proc_dointvec_minmax(table, write, file, buffer, length, ppos);
>  	if (!write || (ret == -EINVAL))
>  		return ret;
> -	for_each_zone(zone) {
> +	for_each_populated_zone(zone) {
>  		for_each_online_cpu(cpu) {
>  			unsigned long  high;
>  			high = zone->present_pages / percpu_pagelist_fraction;

Looks good. thanks for making multiple improvement.

	Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>





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

end of thread, other threads:[~2009-06-23 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 18:24 [PATCH] Fix handling of pagesets for downed cpus Dimitri Sivanich
2009-06-23 10:40 ` KOSAKI Motohiro

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.