Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356487
b: refs/heads/master
c: 10316b3
h: refs/heads/master
i:
  356485: 59a7c02
  356483: b3615d5
  356479: d882709
v: v3
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed Feb 24, 2013
1 parent a5aeb1e commit 8d37749
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 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: d778df51c09264076fe0208c099ef7d428f21790
refs/heads/master: 10316b313cbde4b778c3d1b4b2fe2adbcbe84a48
39 changes: 30 additions & 9 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,6 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
u64 fraction[2], denominator;
enum lru_list lru;
int noswap = 0;
bool force_scan = false;
struct zone *zone = lruvec_zone(lruvec);

Expand All @@ -1677,13 +1676,38 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,

/* If we have no swap space, do not bother scanning anon pages. */
if (!sc->may_swap || (nr_swap_pages <= 0)) {
noswap = 1;
fraction[0] = 0;
fraction[1] = 1;
denominator = 1;
goto out;
}

/*
* Global reclaim will swap to prevent OOM even with no
* swappiness, but memcg users want to use this knob to
* disable swapping for individual groups completely when
* using the memory controller's swap limit feature would be
* too expensive.
*/
if (!global_reclaim(sc) && !vmscan_swappiness(sc)) {
fraction[0] = 0;
fraction[1] = 1;
denominator = 1;
goto out;
}

/*
* Do not apply any pressure balancing cleverness when the
* system is close to OOM, scan both anon and file equally
* (unless the swappiness setting disagrees with swapping).
*/
if (!sc->priority && vmscan_swappiness(sc)) {
fraction[0] = 1;
fraction[1] = 1;
denominator = 1;
goto out;
}

anon = get_lru_size(lruvec, LRU_ACTIVE_ANON) +
get_lru_size(lruvec, LRU_INACTIVE_ANON);
file = get_lru_size(lruvec, LRU_ACTIVE_FILE) +
Expand Down Expand Up @@ -1765,13 +1789,10 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
unsigned long scan;

size = get_lru_size(lruvec, lru);
if (sc->priority || noswap || !vmscan_swappiness(sc)) {
scan = size >> sc->priority;
if (!scan && force_scan)
scan = min(size, SWAP_CLUSTER_MAX);
scan = div64_u64(scan * fraction[file], denominator);
} else
scan = size;
scan = size >> sc->priority;
if (!scan && force_scan)
scan = min(size, SWAP_CLUSTER_MAX);
scan = div64_u64(scan * fraction[file], denominator);
nr[lru] = scan;
}
}
Expand Down

0 comments on commit 8d37749

Please sign in to comment.