Re: [PATCH] mmtom: Prevent shrinking of active anon lru list in case of no swap space V2

From: Minchan Kim
Date: Thu May 14 2009 - 08:05:24 EST


On Thu, May 14, 2009 at 8:44 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
>> >
>> > Changelog since V2
>> > Âo Add new function - can_reclaim_anon : it tests anon_list can be reclaim
>> >
>> > Changelog since V1
>> > Âo Use nr_swap_pages <= 0 in shrink_active_list to prevent scanning Âof active anon list.
>> >
>> > Now shrink_active_list is called several places.
>> > But if we don't have a swap space, we can't reclaim anon pages.
>> > So, we don't need deactivating anon pages in anon lru list.
>> >
>> > Signed-off-by: Minchan Kim <minchan.kim@xxxxxxxxx>
>> > Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
>> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
>> > Cc: Rik van Riel <riel@xxxxxxxxxx>
>>
>> looks good to me. thanks :)
>
> Grr, my fault.
>
>
>
>> Âstatic unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
>> Â Â Â struct zone *zone, struct scan_control *sc, int priority)
>> Â{
>> @@ -1399,7 +1412,7 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
>> Â Â Â Â Â Â Â return 0;
>> Â Â Â }
>>
>> - Â Â if (lru == LRU_ACTIVE_ANON && inactive_anon_is_low(zone, sc)) {
>> + Â Â if (lru == LRU_ACTIVE_ANON && can_reclaim_anon(zone, sc)) {
>> Â Â Â Â Â Â Â shrink_active_list(nr_to_scan, zone, sc, priority, file);
>> Â Â Â Â Â Â Â return 0;
>
> you shouldn't do that. if nr_swap_pages==0, get_scan_ratio return anon=0%.
> then, this branch is unnecessary.
>

But, I think at last it can be happen following as.

1515 * Even if we did not try to evict anon pages at all, we want to
1516 * rebalance the anon lru active/inactive ratio.
1517 */
1518 if (inactive_anon_is_low(zone, sc))
1519 shrink_active_list(SWAP_CLUSTER_MAX, zone, sc, priority, 0);


>
>



--
Kinds 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/