Re: [patch] mm: move pagevec stripping to save unlock-relock

From: MinChan Kim
Date: Wed Feb 25 2009 - 03:13:49 EST


Nice catch!

Reviewed-by: MinChan Kim <minchan.kim@xxxxxxxxx>

On Wed, Feb 25, 2009 at 11:38 AM, Johannes Weiner <hannes@xxxxxxxxxxx> wrote:
> In shrink_active_list() after the deactivation loop, we strip buffer
> heads from the potentially remaining pages in the pagevec.
>
> Currently, this drops the zone's lru lock for stripping, only to
> reacquire it again afterwards to update statistics.
>
> It is not necessary to strip the pages before updating the stats, so
> move the whole thing out of the protected region and save the extra
> locking.
>
> Signed-off-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> ---
> Âmm/vmscan.c | Â Â7 ++-----
> Â1 file changed, 2 insertions(+), 5 deletions(-)
>
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1298,14 +1298,11 @@ static void shrink_active_list(unsigned
> Â Â Â Â}
> Â Â Â Â__mod_zone_page_state(zone, NR_LRU_BASE + lru, pgmoved);
> Â Â Â Âpgdeactivate += pgmoved;
> - Â Â Â if (buffer_heads_over_limit) {
> - Â Â Â Â Â Â Â spin_unlock_irq(&zone->lru_lock);
> - Â Â Â Â Â Â Â pagevec_strip(&pvec);
> - Â Â Â Â Â Â Â spin_lock_irq(&zone->lru_lock);
> - Â Â Â }
> Â Â Â Â__count_zone_vm_events(PGREFILL, zone, pgscanned);
> Â Â Â Â__count_vm_events(PGDEACTIVATE, pgdeactivate);
> Â Â Â Âspin_unlock_irq(&zone->lru_lock);
> + Â Â Â if (buffer_heads_over_limit)
> + Â Â Â Â Â Â Â pagevec_strip(&pvec);
> Â Â Â Âif (vm_swap_full())
> Â Â Â Â Â Â Â Âpagevec_swap_free(&pvec);
>
>
> --
> 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=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>
>



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