Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20210
b: refs/heads/master
c: 2903fb1
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Feb 12, 2006
1 parent 2c6ea68 commit a94df0d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 35 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: 072eaa5d9cc3e63f567ffd9ad87b36194fdd8010
refs/heads/master: 2903fb1694dcb08a3c1d9d823cfae7ba30e66cd3
75 changes: 41 additions & 34 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,47 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
struct page *page;
struct pagevec pvec;
int reclaim_mapped = 0;
long mapped_ratio;
long distress;
long swap_tendency;

if (unlikely(sc->may_swap)) {
long mapped_ratio;
long distress;
long swap_tendency;

/*
* `distress' is a measure of how much trouble we're having
* reclaiming pages. 0 -> no problems. 100 -> great trouble.
*/
distress = 100 >> zone->prev_priority;

/*
* The point of this algorithm is to decide when to start
* reclaiming mapped memory instead of just pagecache. Work out
* how much memory
* is mapped.
*/
mapped_ratio = (sc->nr_mapped * 100) / total_memory;

/*
* Now decide how much we really want to unmap some pages. The
* mapped ratio is downgraded - just because there's a lot of
* mapped memory doesn't necessarily mean that page reclaim
* isn't succeeding.
*
* The distress ratio is important - we don't want to start
* going oom.
*
* A 100% value of vm_swappiness overrides this algorithm
* altogether.
*/
swap_tendency = mapped_ratio / 2 + distress + vm_swappiness;

/*
* Now use this metric to decide whether to start moving mapped
* memory onto the inactive list.
*/
if (swap_tendency >= 100)
reclaim_mapped = 1;
}

lru_add_drain();
spin_lock_irq(&zone->lru_lock);
Expand All @@ -1207,37 +1245,6 @@ refill_inactive_zone(struct zone *zone, struct scan_control *sc)
zone->nr_active -= pgmoved;
spin_unlock_irq(&zone->lru_lock);

/*
* `distress' is a measure of how much trouble we're having reclaiming
* pages. 0 -> no problems. 100 -> great trouble.
*/
distress = 100 >> zone->prev_priority;

/*
* The point of this algorithm is to decide when to start reclaiming
* mapped memory instead of just pagecache. Work out how much memory
* is mapped.
*/
mapped_ratio = (sc->nr_mapped * 100) / total_memory;

/*
* Now decide how much we really want to unmap some pages. The mapped
* ratio is downgraded - just because there's a lot of mapped memory
* doesn't necessarily mean that page reclaim isn't succeeding.
*
* The distress ratio is important - we don't want to start going oom.
*
* A 100% value of vm_swappiness overrides this algorithm altogether.
*/
swap_tendency = mapped_ratio / 2 + distress + vm_swappiness;

/*
* Now use this metric to decide whether to start moving mapped memory
* onto the inactive list.
*/
if (swap_tendency >= 100 && sc->may_swap)
reclaim_mapped = 1;

while (!list_empty(&l_hold)) {
cond_resched();
page = lru_to_page(&l_hold);
Expand Down

0 comments on commit a94df0d

Please sign in to comment.