From: Mel Gorman <mgorman@techsingularity.net>
To: Yanfei Xu <yanfei.xu@windriver.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/page_alloc: avoid counting event if no successful allocation
Date: Fri, 9 Jul 2021 13:26:01 +0100 [thread overview]
Message-ID: <20210709122601.GA3840@techsingularity.net> (raw)
In-Reply-To: <20210709102855.55058-2-yanfei.xu@windriver.com>
On Fri, Jul 09, 2021 at 06:28:55PM +0800, Yanfei Xu wrote:
> While the nr_populated is non-zero, however the nr_account might be
> zero if allocating fails. In this case, not to count event can save
> some cycles.
>
The much more likely path is that nr_account is positive so we avoid a
branch in the common case.
> And this commit extract the check of "page_array" from a while
> statement to avoid unnecessary checks for it.
>
I'm surprised the compiler does not catch that page_array is invariant
for the loop. Did you check if gcc generates different code is page_array
is explicitly checked once instead of putting it in the loop?
--
Mel Gorman
SUSE Labs
next prev parent reply other threads:[~2021-07-09 12:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-09 10:28 [PATCH 1/2] mm/page_alloc: correct return value when failing at preparing Yanfei Xu
2021-07-09 10:28 ` [PATCH 2/2] mm/page_alloc: avoid counting event if no successful allocation Yanfei Xu
2021-07-09 12:26 ` Mel Gorman [this message]
2021-07-10 11:31 ` Xu, Yanfei
2021-07-09 12:22 ` [PATCH 1/2] mm/page_alloc: correct return value when failing at preparing Mel Gorman
2021-07-10 6:58 ` Xu, Yanfei
2021-07-13 12:14 ` Mel Gorman
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=20210709122601.GA3840@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=yanfei.xu@windriver.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.