Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176249
b: refs/heads/master
c: 8fe23e0
h: refs/heads/master
i:
  176247: b59554b
v: v3
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Dec 15, 2009
1 parent 81806ac commit 9bd23cd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9b5e5d0fdc91b73bba8cf5e0fbe3521a953e4e4d
refs/heads/master: 8fe23e057172223fe2048768a4d87ab7de7477bc
1 change: 1 addition & 0 deletions trunk/include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ extern int scan_unevictable_register_node(struct node *node);
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 */
Expand Down
4 changes: 4 additions & 0 deletions trunk/mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ int offline_pages(unsigned long start_pfn,

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();
Expand Down
28 changes: 22 additions & 6 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9bd23cd

Please sign in to comment.