From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBF7441C2EC for ; Wed, 4 Feb 2026 14:58:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217118; cv=none; b=rELQkHuYVx2Hjyk7ipKh8D2fWRUgc2XLV94ZbUfIXiBQsHhyNterGMMOl64tncBhFISBKY3QUUrRnGQoW3v4vAfqOkHc4VRu6ZLUn7Nv3InA825gex6V/qHy67i2qX1WbJ/J96ihkMceFD4WcwxkFtOPTWLCM8YR6p+uddwWzYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217118; c=relaxed/simple; bh=bqFxC9luM4oNb41lGUDRR3eG8ZU4V49zEiFSUErXsAk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ayGRV2IZoxkagzWwqZv46fwvUjevBVt+2KAT0uV+rSMd+7HIbXA9H1sskfawv/g1kv2oE8Q3CIwCjOykgIEjAZ7hNfmuYoJhwP9EX/MNJDF2aNckmLFmh4nemzFM9ZMNYJQdAqDZm9qi7xTRIo3Y6Lt1f6dvG3g7mNo58dzp6R0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=fQGg1kCK; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fQGg1kCK" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=QNknsx76IClWty3KOQy5FfqTMhL6dQS75xtJtyVRIik=; b=fQGg1kCKsbb9tRmG4D43JVgiWR FYwrOuSybbPC5kAkWr8Z5QlTBn0QZch0qYqZTlJ2OpZPc6rVAiowbOrMyL3YAhe2GvRPa0vklXQaq V6dGVLPgcuAkeCBB9RGGjpuhVDzH0t0l1RZ3fGhLr+cDJI2Agi4DsD16+CUlavTm0ofRRHQRlq5ui oQG9c2oyGo49RQmwd2YXhe3AyCKZ3uehq8Rd8iAtu7TuVo0ifmYEXbeWyBuyS3qgiQ8aHF9+v2url 6la0Bcfx6hXvJnRSsYuqBBKS1sEZlKYYe97YtkkKEMKd+fsxgQVhP1mOwWKIQ41fs56HP99yXzDVB BX8lyEQA==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vneKw-00000002EFm-1nY5; Wed, 04 Feb 2026 14:58:34 +0000 Date: Wed, 4 Feb 2026 14:58:34 +0000 From: Matthew Wilcox To: Aswin Kumar 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() Message-ID: References: <20260204142350.1642-1-aswinkumar3301@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260204142350.1642-1-aswinkumar3301@gmail.com> 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().