linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mateusznosek0@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm/page_alloc.c: Micro-optimisation Remove unnecessary branch
Date: Sun, 8 Mar 2020 04:50:07 -0700	[thread overview]
Message-ID: <20200308115007.GE31215@bombadil.infradead.org> (raw)
In-Reply-To: <20200307151542.b14131037dc44a8edcb22cad@linux-foundation.org>

On Sat, Mar 07, 2020 at 03:15:42PM -0800, Andrew Morton wrote:
> On Sat,  7 Mar 2020 23:53:35 +0100 mateusznosek0@gmail.com wrote:
> > -	if (unlikely(ac.nodemask != nodemask))
> > -		ac.nodemask = nodemask;
> > +	ac.nodemask = nodemask;
> 
> This will now unconditionally dirty the ac.nodemask cacheline, which
> means that cacheline will need to be written back.  If it is truly
> unlikely that the write was needed then the thinking goes that the
> test-and-branch is worthwhile, by saving on memory traffic.
> 
> At least, I assume that's why the code is the way it is.

The line immediately before this hunk is:

        ac.spread_dirty_pages = false;

ac is on-stack and is only 32 bytes.  I don't see a reason not to do this.

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>


      reply	other threads:[~2020-03-08 11:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 22:53 mateusznosek0
2020-03-07 23:15 ` Andrew Morton
2020-03-08 11:50   ` Matthew Wilcox [this message]

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=20200308115007.GE31215@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mateusznosek0@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox