Re: [PATCHv3] memcg: fix get_scan_count for small targets

From: Minchan Kim
Date: Wed Apr 27 2011 - 05:15:02 EST


On Wed, Apr 27, 2011 at 5:48 PM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
> On Wed, 27 Apr 2011 17:48:18 +0900
> Minchan Kim <minchan.kim@xxxxxxxxx> wrote:
>
>> On Wed, Apr 27, 2011 at 4:47 PM, KAMEZAWA Hiroyuki
>> <kamezawa.hiroyu@xxxxxxxxxxxxxx> wrote:
>> > At memory reclaim, we determine the number of pages to be scanned
>> > per zone as
>> > Â Â Â Â(anon + file) >> priority.
>> > Assume
>> > Â Â Â Âscan = (anon + file) >> priority.
>> >
>> > If scan < SWAP_CLUSTER_MAX, the scan will be skipped for this time
>> > and priority gets higher. This has some problems.
>> >
>> > Â1. This increases priority as 1 without any scan.
>> > Â Â To do scan in this priority, amount of pages should be larger than 512M.
>> > Â Â If pages>>priority < SWAP_CLUSTER_MAX, it's recorded and scan will be
>> > Â Â batched, later. (But we lose 1 priority.)
>> > Â Â If memory size is below 16M, pages >> priority is 0 and no scan in
>> > Â Â DEF_PRIORITY forever.
>> >
>> > Â2. If zone->all_unreclaimabe==true, it's scanned only when priority==0.
>> > Â Â So, x86's ZONE_DMA will never be recoverred until the user of pages
>> > Â Â frees memory by itself.
>> >
>> > Â3. With memcg, the limit of memory can be small. When using small memcg,
>> > Â Â it gets priority < DEF_PRIORITY-2 very easily and need to call
>> > Â Â wait_iff_congested().
>> > Â Â For doing scan before priorty=9, 64MB of memory should be used.
>> >
>> > Then, this patch tries to scan SWAP_CLUSTER_MAX of pages in force...when
>> >
>> > Â1. the target is enough small.
>> > Â2. it's kswapd or memcg reclaim.
>> >
>> > Then we can avoid rapid priority drop and may be able to recover
>> > all_unreclaimable in a small zones. And this patch removes nr_saved_scan.
>> > This will allow scanning in this priority even when pages >> priority
>> > is very small.
>> >
>> > Changelog v2->v3
>> > Â- removed nr_saved_scan completely.
>> >
>> > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
>> Reviewed-by: Minchan Kim <minchan.kim@xxxxxxxxx>
>>
>> The patch looks good to me but I have a nitpick about just coding style.
>> How about this? I think below looks better but it's just my private
>> opinion and I can't insist on my style. If you don't mind it, ignore.
>>
>
> I did this at the 1st try and got bug.....a variable 'file' here is
> reused and now broken. Renaming it with new variable will be ok, but it

Right you are. I missed that. :)
Thanks.


--
Kind regards,
Minchan Kim
--
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/