linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alex Shi <alex.shi@linux.alibaba.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmstat: don't do count if no needs
Date: Mon, 20 Jul 2020 16:14:04 -0700	[thread overview]
Message-ID: <20200720161404.bd0c24560114bf48d6acbaff@linux-foundation.org> (raw)
In-Reply-To: <1ef9baa0-9788-5917-2590-a8c3fc593b81@linux.alibaba.com>

On Mon, 20 Jul 2020 13:42:45 +0800 Alex Shi <alex.shi@linux.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?



  reply	other threads:[~2020-07-20 23:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20  5:23 [PATCH] mm/vmstat: don't do count if no needs Alex Shi
2020-07-20  5:42 ` Alex Shi
2020-07-20 23:14   ` Andrew Morton [this message]
2020-07-21  3:07     ` Alex Shi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200720161404.bd0c24560114bf48d6acbaff@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).