Re: [PATCH] mm: vmscan: check mem cgroup over reclaimed

From: Hillf Danton
Date: Mon Jan 23 2012 - 22:45:59 EST


Hi all

On Tue, Jan 24, 2012 at 3:04 AM, Ying Han <yinghan@xxxxxxxxxx> wrote:
> On Sun, Jan 22, 2012 at 5:55 PM, Hillf Danton <dhillf@xxxxxxxxx> wrote:
>> To avoid reduction in performance of reclaimee, checking overreclaim is added
>> after shrinking lru list, when pages are reclaimed from mem cgroup.
>>
>> If over reclaim occurs, shrinking remaining lru lists is skipped, and no more
>> reclaim for reclaim/compaction.
>>
>> Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
>> ---
>>
>> --- a/mm/vmscan.c    Mon Jan 23 00:23:10 2012
>> +++ b/mm/vmscan.c    Mon Jan 23 09:57:20 2012
>> @@ -2086,6 +2086,7 @@ static void shrink_mem_cgroup_zone(int p
>> Â Â Â Âunsigned long nr_reclaimed, nr_scanned;
>> Â Â Â Âunsigned long nr_to_reclaim = sc->nr_to_reclaim;
>> Â Â Â Âstruct blk_plug plug;
>> + Â Â Â bool memcg_over_reclaimed = false;
>>
>> Ârestart:
>> Â Â Â Ânr_reclaimed = 0;
>> @@ -2103,6 +2104,11 @@ restart:
>>
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Ânr_reclaimed += shrink_list(lru, nr_to_scan,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âmz, sc, priority);
>> +
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â memcg_over_reclaimed = !scanning_global_lru(mz)
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â && (nr_reclaimed >= nr_to_reclaim);
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â if (memcg_over_reclaimed)
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â goto out;
>
> Why we need the change here? Do we have number to demonstrate?

See below please 8-)

>
>
>> Â Â Â Â Â Â Â Â Â Â Â Â}
>> Â Â Â Â Â Â Â Â}
>> Â Â Â Â Â Â Â Â/*
>> @@ -2116,6 +2122,7 @@ restart:
>> Â Â Â Â Â Â Â Âif (nr_reclaimed >= nr_to_reclaim && priority < DEF_PRIORITY)
>> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
>> Â Â Â Â}
>> +out:
>> Â Â Â Âblk_finish_plug(&plug);
>> Â Â Â Âsc->nr_reclaimed += nr_reclaimed;
>>
>> @@ -2127,7 +2134,8 @@ restart:
>> Â Â Â Â Â Â Â Âshrink_active_list(SWAP_CLUSTER_MAX, mz, sc, priority, 0);
>>
>> Â Â Â Â/* reclaim/compaction might need reclaim to continue */
>> - Â Â Â if (should_continue_reclaim(mz, nr_reclaimed,
>> + Â Â Â if (!memcg_over_reclaimed &&
>> + Â Â Â Â Â should_continue_reclaim(mz, nr_reclaimed,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âsc->nr_scanned - nr_scanned, sc))
>
> This changes the existing logic. What if the nr_reclaimed is greater
> than nr_to_reclaim, but smaller than pages_for_compaction? The
> existing logic is to continue reclaiming.
>
With soft limit available, what if nr_to_reclaim set to be the number of
pages exceeding soft limit? With over reclaim abused, what are the targets
of soft limit?

Thanks
Hillf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/