[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYNemlPABKnQkf-x@casper.infradead.org>
Date: Wed, 4 Feb 2026 14:58:34 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Aswin Kumar <aswinkumar3301@...il.com>
Cc: linux-mm@...ck.org, andrew.morton@...ux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/userfaultfd: fix likely/unlikely annotation in
move_pages()
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().
Powered by blists - more mailing lists