The patch titled mm: clear node in N_HIGH_MEMORY and stop kswapd when all memory is offlined has been removed from the -mm tree. Its filename was mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined.patch This patch was dropped because it was merged into mainline or a subsystem tree The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: mm: clear node in N_HIGH_MEMORY and stop kswapd when all memory is offlined From: David Rientjes <rientjes@xxxxxxxxxx> When memory is hot-removed, its node must be cleared in N_HIGH_MEMORY if there are no present pages left. In such a situation, kswapd must also be stopped since it has nothing left to do. Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Lee Schermerhorn <lee.schermerhorn@xxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx> Cc: Yasunori Goto <y-goto@xxxxxxxxxxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: Rafael J. Wysocki <rjw@xxxxxxx> Cc: Rik van Riel <riel@xxxxxxxxxx> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Lee Schermerhorn <lee.schermerhorn@xxxxxx> Cc: Mel Gorman <mel@xxxxxxxxx> Cc: Randy Dunlap <randy.dunlap@xxxxxxxxxx> Cc: Nishanth Aravamudan <nacc@xxxxxxxxxx> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Adam Litke <agl@xxxxxxxxxx> Cc: Andy Whitcroft <apw@xxxxxxxxxxxxx> Cc: Eric Whitney <eric.whitney@xxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/swap.h | 1 + mm/memory_hotplug.c | 4 ++++ mm/vmscan.c | 28 ++++++++++++++++++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) diff -puN include/linux/swap.h~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined include/linux/swap.h --- a/include/linux/swap.h~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined +++ a/include/linux/swap.h @@ -273,6 +273,7 @@ extern int scan_unevictable_register_nod extern void scan_unevictable_unregister_node(struct node *node); extern int kswapd_run(int nid); +extern void kswapd_stop(int nid); #ifdef CONFIG_MMU /* linux/mm/shmem.c */ diff -puN mm/memory_hotplug.c~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined mm/memory_hotplug.c --- a/mm/memory_hotplug.c~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined +++ a/mm/memory_hotplug.c @@ -853,6 +853,10 @@ repeat: setup_per_zone_wmarks(); calculate_zone_inactive_ratio(zone); + if (!node_present_pages(node)) { + node_clear_state(node, N_HIGH_MEMORY); + kswapd_stop(node); + } vm_total_pages = nr_free_pagecache_pages(); writeback_set_ratelimit(); diff -puN mm/vmscan.c~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined mm/vmscan.c --- a/mm/vmscan.c~mm-clear-node-in-n_high_memory-and-stop-kswapd-when-all-memory-is-offlined +++ a/mm/vmscan.c @@ -2173,6 +2173,7 @@ static int kswapd(void *p) order = 0; for ( ; ; ) { unsigned long new_order; + int ret; prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE); new_order = pgdat->kswapd_max_order; @@ -2184,19 +2185,23 @@ static int kswapd(void *p) */ order = new_order; } else { - if (!freezing(current)) + if (!freezing(current) && !kthread_should_stop()) schedule(); order = pgdat->kswapd_max_order; } finish_wait(&pgdat->kswapd_wait, &wait); - if (!try_to_freeze()) { - /* We can speed up thawing tasks if we don't call - * balance_pgdat after returning from the refrigerator - */ + ret = try_to_freeze(); + if (kthread_should_stop()) + break; + + /* + * We can speed up thawing tasks if we don't call balance_pgdat + * after returning from the refrigerator + */ + if (!ret) balance_pgdat(pgdat, order); - } } return 0; } @@ -2451,6 +2456,17 @@ int kswapd_run(int nid) return ret; } +/* + * Called by memory hotplug when all memory in a node is offlined. + */ +void kswapd_stop(int nid) +{ + struct task_struct *kswapd = NODE_DATA(nid)->kswapd; + + if (kswapd) + kthread_stop(kswapd); +} + static int __init kswapd_init(void) { int nid; _ Patches currently in -mm which might be from rientjes@xxxxxxxxxx are origin.patch acpi-remove-nid_inval.patch oom-kill-show-virtual-size-and-rss-information-of-the-killed-process.patch oom-kill-fix-numa-consraint-check-with-nodemask-v42.patch do_wait-optimization-do-not-place-sub-threads-on-task_struct-children-list.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html