Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254742
b: refs/heads/master
c: 215ddd6
h: refs/heads/master
v: v3
  • Loading branch information
Mel Gorman authored and Linus Torvalds committed Jul 9, 2011
1 parent 5572503 commit 360c781
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 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: da175d06b437093f93109ba9e5efbe44dfdf9409
refs/heads/master: 215ddd6664ced067afca7eebd2d1eb83f064ff5a
34 changes: 21 additions & 13 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2451,7 +2451,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
if (!zone_watermark_ok_safe(zone, order,
high_wmark_pages(zone), 0, 0)) {
end_zone = i;
*classzone_idx = i;
break;
}
}
Expand Down Expand Up @@ -2531,8 +2530,11 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
sc.may_writepage = 1;

if (zone->all_unreclaimable)
if (zone->all_unreclaimable) {
if (end_zone && end_zone == i)
end_zone--;
continue;
}

if (!zone_watermark_ok_safe(zone, order,
high_wmark_pages(zone), end_zone, 0)) {
Expand Down Expand Up @@ -2712,8 +2714,8 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order, int classzone_idx)
*/
static int kswapd(void *p)
{
unsigned long order;
int classzone_idx;
unsigned long order, new_order;
int classzone_idx, new_classzone_idx;
pg_data_t *pgdat = (pg_data_t*)p;
struct task_struct *tsk = current;

Expand Down Expand Up @@ -2743,17 +2745,23 @@ static int kswapd(void *p)
tsk->flags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
set_freezable();

order = 0;
classzone_idx = MAX_NR_ZONES - 1;
order = new_order = 0;
classzone_idx = new_classzone_idx = pgdat->nr_zones - 1;
for ( ; ; ) {
unsigned long new_order;
int new_classzone_idx;
int ret;

new_order = pgdat->kswapd_max_order;
new_classzone_idx = pgdat->classzone_idx;
pgdat->kswapd_max_order = 0;
pgdat->classzone_idx = MAX_NR_ZONES - 1;
/*
* If the last balance_pgdat was unsuccessful it's unlikely a
* new request of a similar or harder type will succeed soon
* so consider going to sleep on the basis we reclaimed at
*/
if (classzone_idx >= new_classzone_idx && order == new_order) {
new_order = pgdat->kswapd_max_order;
new_classzone_idx = pgdat->classzone_idx;
pgdat->kswapd_max_order = 0;
pgdat->classzone_idx = pgdat->nr_zones - 1;
}

if (order < new_order || classzone_idx > new_classzone_idx) {
/*
* Don't sleep if someone wants a larger 'order'
Expand All @@ -2766,7 +2774,7 @@ static int kswapd(void *p)
order = pgdat->kswapd_max_order;
classzone_idx = pgdat->classzone_idx;
pgdat->kswapd_max_order = 0;
pgdat->classzone_idx = MAX_NR_ZONES - 1;
pgdat->classzone_idx = pgdat->nr_zones - 1;
}

ret = try_to_freeze();
Expand Down

0 comments on commit 360c781

Please sign in to comment.