Skip to content

Commit bce7394

Browse files
Minchan Kimtorvalds
authored andcommitted
page-allocator: reset wmark_min and inactive ratio of zone when hotplug happens
Solve two problems. Whenever memory hotplug sucessfully happens, zone->present_pages have to be changed. 1) Now memory hotplug calls setup_per_zone_wmark_min only when online_pages called, not offline_pages. It breaks balance. 2) If zone->present_pages is changed, we also have to change zone->inactive_ratio. That's because inactive_ratio depends on zone->present_pages. Signed-off-by: Minchan Kim <minchan.kim@gmail.com> Acked-by: Yasunori Goto <y-goto@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 96cb4df commit bce7394

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎mm/memory_hotplug.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
423423
zone->zone_pgdat->node_present_pages += onlined_pages;
424424

425425
setup_per_zone_wmarks();
426+
calculate_zone_inactive_ratio(zone);
426427
if (onlined_pages) {
427428
kswapd_run(zone_to_nid(zone));
428429
node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
@@ -832,6 +833,9 @@ int offline_pages(unsigned long start_pfn,
832833
totalram_pages -= offlined_pages;
833834
num_physpages -= offlined_pages;
834835

836+
setup_per_zone_wmarks();
837+
calculate_zone_inactive_ratio(zone);
838+
835839
vm_total_pages = nr_free_pagecache_pages();
836840
writeback_set_ratelimit();
837841

‎mm/page_alloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4397,7 +4397,7 @@ static void setup_per_zone_lowmem_reserve(void)
43974397

43984398
/**
43994399
* setup_per_zone_wmarks - called when min_free_kbytes changes
4400-
* or when memory is hot-added
4400+
* or when memory is hot-{added|removed}
44014401
*
44024402
* Ensures that the watermark[min,low,high] values for each zone are set
44034403
* correctly with respect to min_free_kbytes.

0 commit comments

Comments
 (0)