From patchwork Fri Oct 4 16:48:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Breno Leitao X-Patchwork-Id: 13822779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F1B0CF884D for ; Fri, 4 Oct 2024 16:48:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FC986B031D; Fri, 4 Oct 2024 12:48:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4889F6B031F; Fri, 4 Oct 2024 12:48:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FF956B0322; Fri, 4 Oct 2024 12:48:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 09E866B031D for ; Fri, 4 Oct 2024 12:48:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 89B3C120A91 for ; Fri, 4 Oct 2024 16:48:40 +0000 (UTC) X-FDA: 82636503600.25.FFBB054 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) by imf24.hostedemail.com (Postfix) with ESMTP id C440118000D for ; Fri, 4 Oct 2024 16:48:38 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of breno.debian@gmail.com designates 209.85.208.177 as permitted sender) smtp.mailfrom=breno.debian@gmail.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728060478; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references; bh=qJ8pYY6Zd7fddNahTZhdRdnv30EEZoS+DZMVU4schMU=; b=XBz7oHT7Pka8C8jNNUrTF1MfFBBCSVsHvvXz5qMkVuWomyOER8veI+pUxjwVEFNUFbny20 aWRdpL1BZveBKitLaPQJsF8HlP5+QhQH5az+sQzat01LaaVrcyVPkqbSZVrZJJOGv0TK5S xC/MyOW5M6b+WhtXgBefOsN2oUPdKaw= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of breno.debian@gmail.com designates 209.85.208.177 as permitted sender) smtp.mailfrom=breno.debian@gmail.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728060478; a=rsa-sha256; cv=none; b=x5OHxPY8CfLuEfMtRIXqajEtJbwq6E4kezgnVbRBqATyR1qpIW+kOfB19TsZzDxQC8vNAS gWJEY0SSwHObGuSSgl6CsJIZQhRRMtQXXaRhHaxyPna4hCbkq3A1f2X3I2UiamJn6cDsqM jg2PJf7o2s3SN606PKkbbyBLGds10Nw= Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2fac3f1287bso27816461fa.1 for ; Fri, 04 Oct 2024 09:48:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728060517; x=1728665317; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qJ8pYY6Zd7fddNahTZhdRdnv30EEZoS+DZMVU4schMU=; b=j0WukMJXhfr7gnxfMBA8LFMQ2/hUuo67d+DJ45Bk5sUuCvbiuevYeowvmgY40ruk9N YopmmJL9g1l4HCeviVY4biIwlqDQ1/tK+gSBZYinew7rWkfB8wVl6BoCWDVVoO3ejZkW M4mfWCtxYFYsy2AP8IqIXU0YtllzR+X53HlSEn4e5mtfayaL3L/vHvokLFccKoLbUFrU aksmGJpXOizPAQ7UqvwpMXmpH36Nhbtd5WqLwMqBnGG2tjzWzDoyMTLDuE7EGII72dOX lvtndslnORsZmu6rYr9EgVQBoEtkj0A8EVB1tZctBhQg6N0SnYku1Jc/GR0jS+VmR40r Pc6g== X-Forwarded-Encrypted: i=1; AJvYcCXRA9uuBw4mFFyQPWV9v4/dqFEc373beu5F9npX+g2DfoQqc/JOZojpu4MseW8EZc3GNvAJsAgY7w==@kvack.org X-Gm-Message-State: AOJu0YwjgEDeH4x2C5B9ngsjMWiG8XshOqxfyUFuthQhrL1FSQcYf22F a/t3Ggg7hhdUO65s6z/InYgVatSVsL/GlO6U/c8YBrM6gLDdGVCy X-Google-Smtp-Source: AGHT+IHHbsB5ExN8EODYivpvboNCip8OBKovQd6mcj5VWlTiHwfnQxJ0d1YJMNb1m762tSIe8X7/dg== X-Received: by 2002:a05:6512:281b:b0:536:a583:2777 with SMTP id 2adb3069b0e04-539ab85b5bemr2219263e87.9.1728060516717; Fri, 04 Oct 2024 09:48:36 -0700 (PDT) Received: from localhost (fwdproxy-lla-009.fbsv.net. [2a03:2880:30ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e7c46e3sm14141766b.180.2024.10.04.09.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 09:48:36 -0700 (PDT) From: Breno Leitao To: Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , Lorenzo Stoakes Cc: kernel-team@meta.com, linux-mm@kvack.org (open list:VMA), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] mm: Remove misleading 'unlikely' hint in vms_gather_munmap_vmas() Date: Fri, 4 Oct 2024 09:48:31 -0700 Message-ID: <20241004164832.218681-1-leitao@debian.org> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: otj98edibpx6na8oc44fsogt59rer353 X-Rspamd-Que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vritGIn7BiOz8Uh0qZHKgdtt/DD373iPl7b0z3X2gnjLMIi02cQt/HffspJS3Q3nzUIrWG+3QXKKrZaaeI9HdqdmwVYryJ1GB3jy4ayGFHxwL+A5tokAHy/AkyWlnfEd4v53zR9Msyrhp12KXqhOCejcNNgrm9C8WINRC0V8P/mnGnwheqI4ut/pATilC5HDwcsgQ91CqyH5D6RPvFCjcpypukM/qkv0zH/3685egY+yz0wSH4PXyk3pihUm40QJyY9swv6ExQIbwSrai66Kr6A9gRfccm/6b5zEpagOj+pflR/qdKMhfv+4SFsUSX96zc5qLrdLY32F7Dw20gsA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Performance analysis using branch annotation on a fleet of 200 hosts running web servers revealed that the 'likely' hint in vms_gather_munmap_vmas() was 100% consistently incorrect. In all observed cases, the branch behavior contradicted the hint. Remove the 'unlikely' qualifier from the condition checking 'vms->uf'. By doing so, we allow the compiler to make optimization decisions based on its own heuristics and profiling data, rather than relying on a static hint that has proven to be inaccurate in real-world scenarios. Signed-off-by: Breno Leitao Reviewed-by: Lorenzo Stoakes Acked-by: Vlastimil Babka Reviewed-by: Liam R. Howlett --- mm/vma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vma.c b/mm/vma.c index 4737afcb064c..9d4fe794dd07 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -1250,7 +1250,7 @@ int vms_gather_munmap_vmas(struct vma_munmap_struct *vms, else if (is_data_mapping(next->vm_flags)) vms->data_vm += nrpages; - if (unlikely(vms->uf)) { + if (vms->uf) { /* * If userfaultfd_unmap_prep returns an error the vmas * will remain split, but userland will get a