Re: [PATCH v2 2/2] vmscan: shrink_slab() require number of lru_pages, not page order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 16, 2010 at 10:39 AM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
>> >     nr_slab_pages0 = zone_page_state(zone, NR_SLAB_RECLAIMABLE);
>> >     if (nr_slab_pages0 > zone->min_slab_pages) {
>> > +           unsigned long lru_pages = zone_reclaimable_pages(zone);
>> > +
>> >             /*
>> >              * shrink_slab() does not currently allow us to determine how
>> >              * many pages were freed in this zone. So we take the current
>> > @@ -2622,7 +2624,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
>> >              * Note that shrink_slab will free memory on all zones and may
>> >              * take a long time.
>> >              */
>> > -           while (shrink_slab(sc.nr_scanned, gfp_mask, order) &&
>> > +           while (shrink_slab(sc.nr_scanned, gfp_mask, lru_pages) &&
>> >                    (zone_page_state(zone, NR_SLAB_RECLAIMABLE) + nr_pages >
>> >                     nr_slab_pages0))
>> >                     ;
>>
>> Wouldn't it be better to recalculate zone_reclaimable_pages() each time
>> around the loop?  For example, shrink_icache_memory()->prune_icache()
>> will remove pagecache from an inode if it hits the tail of the list.
>> This can change the number of reclaimable pages by squigabytes, but
>> this code thinks nothing changed?
>
> Ah, I missed this. incrementa patch is here.
>
> thank you!
>
>
>
> From 8f7c70cfb4a25f8292a59564db6c3ff425a69b53 Mon Sep 17 00:00:00 2001
> From: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> Date: Fri, 16 Jul 2010 08:40:01 +0900
> Subject: [PATCH] vmscan: recalculate lru_pages on each shrink_slab()
>
> Andrew Morton pointed out shrink_slab() may change number of reclaimable
> pages (e.g. shrink_icache_memory()->prune_icache() will remove unmapped
> pagecache).
>
> So, we need to recalculate lru_pages on each shrink_slab() calling.
> This patch fixes it.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
Reviewed-by: Minchan Kim <minchan.kim@xxxxxxxxx>

It does make sense.

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]