[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200720161404.bd0c24560114bf48d6acbaff@linux-foundation.org>
Date: Mon, 20 Jul 2020 16:14:04 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Alex Shi <alex.shi@...ux.alibaba.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/vmstat: don't do count if no needs
On Mon, 20 Jul 2020 13:42:45 +0800 Alex Shi <alex.shi@...ux.alibaba.com> wrote:
>
> For couple of vmstat account funcs, the caller usually doesn't check the
> delta value, if delta == 0, irq or atomic operator is a waste. That's
> better to be skipped, also add unlikey() since !delta is less happened.
>
> ...
>
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -321,6 +321,9 @@ void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
> long x;
> long t;
>
> + if (unlikely(!delta))
> + return;
> +
Do we know that delta==0 is frequent enough to make the change a net
benefit?
Powered by blists - more mailing lists