* [resend][PATCH 1/2] mm, mem-hotplug: recalculate lowmem_reserve when memory hotplug occur
@ 2010-10-19 5:08 KOSAKI Motohiro
2010-10-19 5:09 ` [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold " KOSAKI Motohiro
0 siblings, 1 reply; 9+ messages in thread
From: KOSAKI Motohiro @ 2010-10-19 5:08 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm, Andrew Morton,
Christoph Lameter
Cc: kosaki.motohiro
Currently, memory hotplug call setup_per_zone_wmarks() and
calculate_zone_inactive_ratio(), but don't call setup_per_zone_lowmem_reserve().
It mean number of reserved pages aren't updated even if memory hot plug
occur. This patch fixes it.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
---
include/linux/mm.h | 3 +--
mm/memory_hotplug.c | 9 +++++----
mm/page_alloc.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 721f451..71d1670 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1221,8 +1221,7 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn);
extern void set_dma_reserve(unsigned long new_dma_reserve);
extern void memmap_init_zone(unsigned long, int, unsigned long,
unsigned long, enum memmap_context);
-extern void setup_per_zone_wmarks(void);
-extern void calculate_zone_inactive_ratio(struct zone *zone);
+extern int __meminit init_per_zone_wmark_min(void);
extern void mem_init(void);
extern void __init mmap_init(void);
extern void show_mem(void);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index d8375bb..27d580d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -437,8 +437,9 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
zone_pcp_update(zone);
mutex_unlock(&zonelists_mutex);
- setup_per_zone_wmarks();
- calculate_zone_inactive_ratio(zone);
+
+ init_per_zone_wmark_min();
+
if (onlined_pages) {
kswapd_run(zone_to_nid(zone));
node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
@@ -872,8 +873,8 @@ repeat:
zone->zone_pgdat->node_present_pages -= offlined_pages;
totalram_pages -= offlined_pages;
- setup_per_zone_wmarks();
- calculate_zone_inactive_ratio(zone);
+ init_per_zone_wmark_min();
+
if (!node_present_pages(node)) {
node_clear_state(node, N_HIGH_MEMORY);
kswapd_stop(node);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b48dea2..14ee899 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4880,7 +4880,7 @@ static void setup_per_zone_lowmem_reserve(void)
* Ensures that the watermark[min,low,high] values for each zone are set
* correctly with respect to min_free_kbytes.
*/
-void setup_per_zone_wmarks(void)
+static void setup_per_zone_wmarks(void)
{
unsigned long pages_min = min_free_kbytes >> (PAGE_SHIFT - 10);
unsigned long lowmem_pages = 0;
@@ -4956,7 +4956,7 @@ void setup_per_zone_wmarks(void)
* 1TB 101 10GB
* 10TB 320 32GB
*/
-void calculate_zone_inactive_ratio(struct zone *zone)
+static void calculate_zone_inactive_ratio(struct zone *zone)
{
unsigned int gb, ratio;
@@ -5002,7 +5002,7 @@ static void __init setup_per_zone_inactive_ratio(void)
* 8192MB: 11584k
* 16384MB: 16384k
*/
-static int __init init_per_zone_wmark_min(void)
+int __meminit init_per_zone_wmark_min(void)
{
unsigned long lowmem_kbytes;
--
1.6.5.2
--
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] 9+ messages in thread
* [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 5:08 [resend][PATCH 1/2] mm, mem-hotplug: recalculate lowmem_reserve when memory hotplug occur KOSAKI Motohiro
@ 2010-10-19 5:09 ` KOSAKI Motohiro
2010-10-19 14:41 ` Christoph Lameter
2010-10-19 19:11 ` David Rientjes
0 siblings, 2 replies; 9+ messages in thread
From: KOSAKI Motohiro @ 2010-10-19 5:09 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm, Andrew Morton,
Christoph Lameter
Currently, cpu hotplug updates pcp->stat_threashold, but memory
hotplug doesn't. there is no reason.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
---
include/linux/vmstat.h | 5 ++++-
mm/page_alloc.c | 3 +++
mm/vmstat.c | 5 ++---
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index eaaea37..1997988 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -254,6 +254,7 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item);
extern void __dec_zone_state(struct zone *, enum zone_stat_item);
void refresh_cpu_vm_stats(int);
+void refresh_zone_stat_thresholds(void);
#else /* CONFIG_SMP */
/*
@@ -299,6 +300,8 @@ static inline void __dec_zone_page_state(struct page *page,
#define mod_zone_page_state __mod_zone_page_state
static inline void refresh_cpu_vm_stats(int cpu) { }
-#endif
+static inline void refresh_zone_stat_thresholds(void) { }
+
+#endif /* CONFIG_SMP */
#endif /* _LINUX_VMSTAT_H */
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 14ee899..222d8cc 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -51,6 +51,7 @@
#include <linux/kmemleak.h>
#include <linux/memory.h>
#include <linux/compaction.h>
+#include <linux/vmstat.h>
#include <trace/events/kmem.h>
#include <linux/ftrace_event.h>
@@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
min_free_kbytes = 128;
if (min_free_kbytes > 65536)
min_free_kbytes = 65536;
+
+ refresh_zone_stat_thresholds();
setup_per_zone_wmarks();
setup_per_zone_lowmem_reserve();
setup_per_zone_inactive_ratio();
diff --git a/mm/vmstat.c b/mm/vmstat.c
index cd2e42b..b6b7fed 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -133,7 +133,7 @@ static int calculate_threshold(struct zone *zone)
/*
* Refresh the thresholds for each zone.
*/
-static void refresh_zone_stat_thresholds(void)
+void refresh_zone_stat_thresholds(void)
{
struct zone *zone;
int cpu;
@@ -371,7 +371,7 @@ void refresh_cpu_vm_stats(int cpu)
atomic_long_add(global_diff[i], &vm_stat[i]);
}
-#endif
+#endif /* CONFIG_SMP */
#ifdef CONFIG_NUMA
/*
@@ -1059,7 +1059,6 @@ static int __init setup_vmstat(void)
#ifdef CONFIG_SMP
int cpu;
- refresh_zone_stat_thresholds();
register_cpu_notifier(&vmstat_notifier);
for_each_online_cpu(cpu)
--
1.6.5.2
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 5:09 ` [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold " KOSAKI Motohiro
@ 2010-10-19 14:41 ` Christoph Lameter
2010-10-19 19:11 ` David Rientjes
1 sibling, 0 replies; 9+ messages in thread
From: Christoph Lameter @ 2010-10-19 14:41 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm, Andrew Morton
On Tue, 19 Oct 2010, KOSAKI Motohiro wrote:
> Currently, cpu hotplug updates pcp->stat_threashold, but memory
> hotplug doesn't. there is no reason.
Acked-by: Christoph Lameter <cl@linux.com>
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 5:09 ` [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold " KOSAKI Motohiro
2010-10-19 14:41 ` Christoph Lameter
@ 2010-10-19 19:11 ` David Rientjes
2010-10-19 23:29 ` Andrew Morton
2010-10-20 2:36 ` KOSAKI Motohiro
1 sibling, 2 replies; 9+ messages in thread
From: David Rientjes @ 2010-10-19 19:11 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm, Andrew Morton,
Christoph Lameter
On Tue, 19 Oct 2010, KOSAKI Motohiro wrote:
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 14ee899..222d8cc 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -51,6 +51,7 @@
> #include <linux/kmemleak.h>
> #include <linux/memory.h>
> #include <linux/compaction.h>
> +#include <linux/vmstat.h>
> #include <trace/events/kmem.h>
> #include <linux/ftrace_event.h>
>
> @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> min_free_kbytes = 128;
> if (min_free_kbytes > 65536)
> min_free_kbytes = 65536;
> +
> + refresh_zone_stat_thresholds();
> setup_per_zone_wmarks();
> setup_per_zone_lowmem_reserve();
> setup_per_zone_inactive_ratio();
setup_per_zone_wmarks() could change the min and low watermarks for a zone
when refresh_zone_stat_thresholds() would have used the old value.
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 19:11 ` David Rientjes
@ 2010-10-19 23:29 ` Andrew Morton
2010-10-20 2:07 ` KOSAKI Motohiro
2010-10-20 2:36 ` KOSAKI Motohiro
1 sibling, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2010-10-19 23:29 UTC (permalink / raw)
To: David Rientjes
Cc: KOSAKI Motohiro, KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm,
Christoph Lameter
On Tue, 19 Oct 2010 12:11:09 -0700 (PDT)
David Rientjes <rientjes@google.com> wrote:
> On Tue, 19 Oct 2010, KOSAKI Motohiro wrote:
>
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 14ee899..222d8cc 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -51,6 +51,7 @@
> > #include <linux/kmemleak.h>
> > #include <linux/memory.h>
> > #include <linux/compaction.h>
> > +#include <linux/vmstat.h>
> > #include <trace/events/kmem.h>
> > #include <linux/ftrace_event.h>
> >
> > @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> > min_free_kbytes = 128;
> > if (min_free_kbytes > 65536)
> > min_free_kbytes = 65536;
> > +
> > + refresh_zone_stat_thresholds();
> > setup_per_zone_wmarks();
> > setup_per_zone_lowmem_reserve();
> > setup_per_zone_inactive_ratio();
>
> setup_per_zone_wmarks() could change the min and low watermarks for a zone
> when refresh_zone_stat_thresholds() would have used the old value.
Indeed.
I could make the obvious fix, but then what I'd have wouldn't be
sufficiently tested.
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 23:29 ` Andrew Morton
@ 2010-10-20 2:07 ` KOSAKI Motohiro
2010-10-20 2:22 ` Andrew Morton
0 siblings, 1 reply; 9+ messages in thread
From: KOSAKI Motohiro @ 2010-10-20 2:07 UTC (permalink / raw)
To: Andrew Morton
Cc: kosaki.motohiro, David Rientjes, KAMEZAWA Hiroyuki, Mel Gorman,
LKML, linux-mm, Christoph Lameter
> > > @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> > > min_free_kbytes = 128;
> > > if (min_free_kbytes > 65536)
> > > min_free_kbytes = 65536;
> > > +
> > > + refresh_zone_stat_thresholds();
> > > setup_per_zone_wmarks();
> > > setup_per_zone_lowmem_reserve();
> > > setup_per_zone_inactive_ratio();
> >
> > setup_per_zone_wmarks() could change the min and low watermarks for a zone
> > when refresh_zone_stat_thresholds() would have used the old value.
>
> Indeed.
>
> I could make the obvious fix, but then what I'd have wouldn't be
> sufficiently tested.
Can we review this?
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-20 2:07 ` KOSAKI Motohiro
@ 2010-10-20 2:22 ` Andrew Morton
2010-10-20 2:35 ` KOSAKI Motohiro
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2010-10-20 2:22 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: David Rientjes, KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm,
Christoph Lameter
On Wed, 20 Oct 2010 11:07:33 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> > > > @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> > > > min_free_kbytes = 128;
> > > > if (min_free_kbytes > 65536)
> > > > min_free_kbytes = 65536;
> > > > +
> > > > + refresh_zone_stat_thresholds();
> > > > setup_per_zone_wmarks();
> > > > setup_per_zone_lowmem_reserve();
> > > > setup_per_zone_inactive_ratio();
> > >
> > > setup_per_zone_wmarks() could change the min and low watermarks for a zone
> > > when refresh_zone_stat_thresholds() would have used the old value.
> >
> > Indeed.
> >
> > I could make the obvious fix, but then what I'd have wouldn't be
> > sufficiently tested.
>
> Can we review this?
It's unclear what you mean?
The patches otherwise look OK to me, but it's pretty easy to make
mistakes in this area.
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-20 2:22 ` Andrew Morton
@ 2010-10-20 2:35 ` KOSAKI Motohiro
0 siblings, 0 replies; 9+ messages in thread
From: KOSAKI Motohiro @ 2010-10-20 2:35 UTC (permalink / raw)
To: Andrew Morton
Cc: kosaki.motohiro, David Rientjes, KAMEZAWA Hiroyuki, Mel Gorman,
LKML, linux-mm, Christoph Lameter
> On Wed, 20 Oct 2010 11:07:33 +0900 (JST) KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
> > > > > @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> > > > > min_free_kbytes = 128;
> > > > > if (min_free_kbytes > 65536)
> > > > > min_free_kbytes = 65536;
> > > > > +
> > > > > + refresh_zone_stat_thresholds();
> > > > > setup_per_zone_wmarks();
> > > > > setup_per_zone_lowmem_reserve();
> > > > > setup_per_zone_inactive_ratio();
> > > >
> > > > setup_per_zone_wmarks() could change the min and low watermarks for a zone
> > > > when refresh_zone_stat_thresholds() would have used the old value.
> > >
> > > Indeed.
> > >
> > > I could make the obvious fix, but then what I'd have wouldn't be
> > > sufficiently tested.
> >
> > Can we review this?
>
> It's unclear what you mean?
>
> The patches otherwise look OK to me, but it's pretty easy to make
> mistakes in this area.
Ah, I misunderstood. I thought you have perfectly different approach patch.
I'll respin.
Thanks.
--
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] 9+ messages in thread
* Re: [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold when memory hotplug occur
2010-10-19 19:11 ` David Rientjes
2010-10-19 23:29 ` Andrew Morton
@ 2010-10-20 2:36 ` KOSAKI Motohiro
1 sibling, 0 replies; 9+ messages in thread
From: KOSAKI Motohiro @ 2010-10-20 2:36 UTC (permalink / raw)
To: David Rientjes
Cc: kosaki.motohiro, KAMEZAWA Hiroyuki, Mel Gorman, LKML, linux-mm,
Andrew Morton, Christoph Lameter
> On Tue, 19 Oct 2010, KOSAKI Motohiro wrote:
>
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 14ee899..222d8cc 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -51,6 +51,7 @@
> > #include <linux/kmemleak.h>
> > #include <linux/memory.h>
> > #include <linux/compaction.h>
> > +#include <linux/vmstat.h>
> > #include <trace/events/kmem.h>
> > #include <linux/ftrace_event.h>
> >
> > @@ -5013,6 +5014,8 @@ int __meminit init_per_zone_wmark_min(void)
> > min_free_kbytes = 128;
> > if (min_free_kbytes > 65536)
> > min_free_kbytes = 65536;
> > +
> > + refresh_zone_stat_thresholds();
> > setup_per_zone_wmarks();
> > setup_per_zone_lowmem_reserve();
> > setup_per_zone_inactive_ratio();
>
> setup_per_zone_wmarks() could change the min and low watermarks for a zone
> when refresh_zone_stat_thresholds() would have used the old value.
Good catch. thanks.
my previous version removed zone->percpu_drift_mark completely. but
current one doesn't. so I need to fix this.
--
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] 9+ messages in thread
end of thread, other threads:[~2010-10-20 2:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19 5:08 [resend][PATCH 1/2] mm, mem-hotplug: recalculate lowmem_reserve when memory hotplug occur KOSAKI Motohiro
2010-10-19 5:09 ` [resend][PATCH 2/2] mm, mem-hotplug: update pcp->stat_threshold " KOSAKI Motohiro
2010-10-19 14:41 ` Christoph Lameter
2010-10-19 19:11 ` David Rientjes
2010-10-19 23:29 ` Andrew Morton
2010-10-20 2:07 ` KOSAKI Motohiro
2010-10-20 2:22 ` Andrew Morton
2010-10-20 2:35 ` KOSAKI Motohiro
2010-10-20 2:36 ` KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox