linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Matthew Wilcox <willy@infradead.org>,
	Aswin Kumar <aswinkumar3301@gmail.com>
Cc: linux-mm@kvack.org, andrew.morton@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/userfaultfd: fix likely/unlikely annotation in move_pages()
Date: Thu, 12 Feb 2026 13:47:34 +0100	[thread overview]
Message-ID: <21a9b331-58ec-4c04-a09e-545ac31f2eca@kernel.org> (raw)
In-Reply-To: <aYNemlPABKnQkf-x@casper.infradead.org>

On 2/4/26 15:58, Matthew Wilcox wrote:
> On Wed, Feb 04, 2026 at 02:23:50PM +0000, Aswin Kumar wrote:
>> All other userfaultfd paths use unlikely() for the mmap_changing check,
> 
> No they don't?
> 
> $ git grep mmap_changing mm
> mm/userfaultfd.c:               if (atomic_read(&ctx->mmap_changing))
> mm/userfaultfd.c:       if (atomic_read(&ctx->mmap_changing))
> mm/userfaultfd.c:       if (atomic_read(&ctx->mmap_changing))
> mm/userfaultfd.c:       if (likely(atomic_read(&ctx->mmap_changing)))
> 
>> This is a performance-only fix - the logic is correct but the branch
>> prediction annotation is wrong, potentially causing a minor performance
>> penalty on the fast path.
> 
> Can you measure it?  Bet you can't.
> 
> Honestly, I'd just remove the likely() annotation, not change it to
> unlikely().

Agreed.

-- 
Cheers,

David


      reply	other threads:[~2026-02-12 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 14:23 Aswin Kumar
2026-02-04 14:58 ` Matthew Wilcox
2026-02-12 12:47   ` David Hildenbrand (Arm) [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=21a9b331-58ec-4c04-a09e-545ac31f2eca@kernel.org \
    --to=david@kernel.org \
    --cc=andrew.morton@linux-foundation.org \
    --cc=aswinkumar3301@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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