Skip to content

Commit

Permalink
page-allocator: reset wmark_min and inactive ratio of zone when hotpl…
Browse files Browse the repository at this point in the history
…ug 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 <[email protected]>
Acked-by: Yasunori Goto <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: KOSAKI Motohiro <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Minchan Kim authored and torvalds committed Jun 17, 2009
1 parent 96cb4df commit bce7394
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
zone->zone_pgdat->node_present_pages += onlined_pages;

setup_per_zone_wmarks();
calculate_zone_inactive_ratio(zone);
if (onlined_pages) {
kswapd_run(zone_to_nid(zone));
node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
Expand Down Expand Up @@ -832,6 +833,9 @@ int offline_pages(unsigned long start_pfn,
totalram_pages -= offlined_pages;
num_physpages -= offlined_pages;

setup_per_zone_wmarks();
calculate_zone_inactive_ratio(zone);

vm_total_pages = nr_free_pagecache_pages();
writeback_set_ratelimit();

Expand Down
2 changes: 1 addition & 1 deletion mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4397,7 +4397,7 @@ static void setup_per_zone_lowmem_reserve(void)

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

0 comments on commit bce7394

Please sign in to comment.