Skip to content

Commit

Permalink
[PATCH] vmscan: fix zone_reclaim
Browse files Browse the repository at this point in the history
- PF_SWAPWRITE needs to be set for RECLAIM_SWAP to be able to write
  out pages to swap. Currently RECLAIM_SWAP may not do that.

- remove setting nr_reclaimed pages after slab reclaim since the slab shrinking
  code does not use that and the nr_reclaimed pages is just right for the
  intended follow up action.

Signed-off-by: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Feb 24, 2006
1 parent c04030e commit d4f7796
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,12 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
sc.swap_cluster_max = SWAP_CLUSTER_MAX;

cond_resched();
p->flags |= PF_MEMALLOC;
/*
* We need to be able to allocate from the reserves for RECLAIM_SWAP
* and we also need to be able to write out pages for RECLAIM_WRITE
* and RECLAIM_SWAP.
*/
p->flags |= PF_MEMALLOC | PF_SWAPWRITE;
reclaim_state.reclaimed_slab = 0;
p->reclaim_state = &reclaim_state;

Expand All @@ -1932,11 +1937,10 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
* a long time.
*/
shrink_slab(sc.nr_scanned, gfp_mask, order);
sc.nr_reclaimed = 1; /* Avoid getting the off node timeout */
}

p->reclaim_state = NULL;
current->flags &= ~PF_MEMALLOC;
current->flags &= ~(PF_MEMALLOC | PF_SWAPWRITE);

if (sc.nr_reclaimed == 0)
zone->last_unsuccessful_zone_reclaim = jiffies;
Expand Down

0 comments on commit d4f7796

Please sign in to comment.