On Thu, Apr 12, 2012 at 6:00 AM, Ying Han <yinghan@xxxxxxxxxx> wrote: > Under global background reclaim, the sc->nr_to_reclaim is set to > ULONG_MAX. Now we are iterating all memcgs under the zone and we > shouldn't pass the pressure from kswapd for each memcg. > > After all, the balance_pgdat() breaks after reclaiming SWAP_CLUSTER_MAX > pages to prevent building up reclaim priorities. > > Signed-off-by: Ying Han <yinghan@xxxxxxxxxx> > --- > mm/vmscan.c | 12 ++++++++++-- > 1 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index d65eae4..ca70ec6 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2083,9 +2083,18 @@ static void shrink_mem_cgroup_zone(int priority, struct mem_cgroup_zone *mz, > unsigned long nr_to_scan; > enum lru_list lru; > unsigned long nr_reclaimed, nr_scanned; > - unsigned long nr_to_reclaim = sc->nr_to_reclaim; > + unsigned long nr_to_reclaim; > struct blk_plug plug; > > + /* > + * Under global background reclaim, the sc->nr_to_reclaim is set to > + * ULONG_MAX. Now we are iterating all memcgs under the zone and we > + * shouldn't pass the pressure from kswapd for each memcg. After all, > + * the balance_pgdat() breaks after reclaiming SWAP_CLUSTER_MAX pages > + * to prevent building up reclaim priorities. > + */ > + nr_to_reclaim = min_t(unsigned long, > + sc->nr_to_reclaim, SWAP_CLUSTER_MAX); > restart: > nr_reclaimed = 0; > nr_scanned = sc->nr_scanned; > Since priority is one of the factors used in computing scan count, we could change how to select a memcg for reclaim, return target_mem_cgroup || mem_cgroup_soft_limit_exceeded(memcg) || priority != DEF_PRIORITY; where detection of all mem groups under softlimit happens at DEF_PRIORITY-1. Then selected mem groups are reclaimed in the current manner without change in nr_to_reclaim, and sc->nr_reclaimed is distributed evenly among mem groups, no matter softlimt is exceeded or not. -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href