From patchwork Tue Apr 1 14:35:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 14034965 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 AA3B2C36010 for ; Tue, 1 Apr 2025 14:35:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31499280004; Tue, 1 Apr 2025 10:35:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C42A280001; Tue, 1 Apr 2025 10:35:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18C55280004; Tue, 1 Apr 2025 10:35:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id EF09C280001 for ; Tue, 1 Apr 2025 10:35:33 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8C102120149 for ; Tue, 1 Apr 2025 14:35:35 +0000 (UTC) X-FDA: 83285723430.01.18DBB05 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by imf28.hostedemail.com (Postfix) with ESMTP id A505AC000B for ; Tue, 1 Apr 2025 14:35:33 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="K/4Llvyt"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743518133; a=rsa-sha256; cv=none; b=AG3eN2hgnweQwROTuk0lw/PFbMnuR6033tlhbcxqnawEpRU9y7tD7XAigO4GINi9xLmsAI uzq8gvFe00PjyMmVb8uubKv76Ry3u0iX/pS86oLJ+PNLb1MVx0/0pOHhij/VM+IL6O+UaZ 4XpcZnzMU7qV0x0ekNlNeUWTw4PWPJk= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="K/4Llvyt"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.221.48 as permitted sender) smtp.mailfrom=mjguzik@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743518133; 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:dkim-signature; bh=BZyefUB9KxdHlktsqY/xqs14rudVRci25F3JTS7wlgs=; b=4Hvvt0LHJm/WHbk8olOqQo8kGsig8tvt1SfmiTfWVHUnx75NSNyQoU3vaZjK/1QL9Un8uo sSPRPyCwKM0JWUHcpYFQchHbQOiLfbPY5WatMY+XZ1yFlQZeBjIgNgTnFva+u+9SfKGhus W7DgENMamzZxKB0U5sbRBFlxoW+FaQw= Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-38a25d4b9d4so2921055f8f.0 for ; Tue, 01 Apr 2025 07:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743518132; x=1744122932; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BZyefUB9KxdHlktsqY/xqs14rudVRci25F3JTS7wlgs=; b=K/4LlvytMrRK0jH8/0xXIjtf73RaMiioJz7L76j6opPi2dZ86Zvv3oeN0pRs0n2pnr rm1G3EFWLTaeYTFq4XPVMviED4/tWO272ju2MQxN1BwsKrWcT8CMmRBUEmzajuiADHHu SqzIiCZ+yRLV1pUrkDJcBIG7u7hy4QTMSc6vzv6IGmqEo4I8r1QGBlQR5yVtxMzT84Wy TjWEPHJwj8UUGRs4ylLz4Sv9DOaweX3xLZCuNLN6Ca5ouGif3UG5M+00ZSUzrzf8ZwEO zEqm+tc1jI9iNhYmSjnIn0t+5WHgaX7ZKIfXVsR6C99Sr60qeB2zAW5bUHrRbZ66Xk+S EhaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743518132; x=1744122932; 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=BZyefUB9KxdHlktsqY/xqs14rudVRci25F3JTS7wlgs=; b=xOcNu8MJ6xaSrwifMzK1VBn7+BQNFBG7PFrYxFH2uM8+o2AIB3nCZ1nAh+jlRGsAWx qUcgUM75kwcwvShscKs3zk1ZSXJ8tqpjXnweI7pCGN/HVOagsCf4+iIYTUUMzeHoS9Yy dM4mx+VSWwGQ53HBw01OIflS3+55u2zIECHh3CmgYy+q1gXMk27VAuyUWoLrD7EGGRBU ewfsnHcvlXtdCmZiaTtzk8RQIEKH4U/fgKo2AHzAUiU7Lq6Lu3/qh6uZmuP0AhEYpUaX J4Y9g/ocXnKiC97LyTtgaq8nDeGpBLfXQDfEvDGgyVjF+cumwB7N16L8QTPyXto9w8E5 jzKg== X-Gm-Message-State: AOJu0Yz/USLYBCFbrtbD+EPJVtTGOGnopuof2k4CxrdY3qA9RlRNbEml Q4KG0oEVL7Ox73Cz05EkmdvnRVJvte/ZnZ8S1iY7CTyR9QQe7ZPB X-Gm-Gg: ASbGncti9BH01J8VwJMCvjP7l4pvX+QCqtbzQa/MYygTndBfMitDdWdsZJK4eE4MoST GNB2UkWxrKgJ5y9oD/oCFl+KpZfjFEpVa087dxVzCd+oTby00sxlUO27oxbu075sEZbD+1q4DA1 sslePmWuqbSrOI4BxuPSfg+tlMMczPM3Qv2cNTK2VK1niiJNYr2UEtDX2fKObBJ5HKu+ewy2Urk enXqffjGge9jtXlRNzbB8n+9rEtJmtdf7PpSO7mfhlnPsDtJ5y+uBb1D3ckCdOdYb5YeALlcswH nZ2wg6AyJsxjdx2Mj5gyzhIEvy4mQcbkMVi4N764uqyv67iuVEVxR2cb20kE X-Google-Smtp-Source: AGHT+IHhBDh1ohT1evya9ki0/u7U88oAEymPVw6ey8QRvgZWUTKQYWRrpJZRb7KTrGDiRVJVhiiiYQ== X-Received: by 2002:a05:6000:144e:b0:391:47d8:de3d with SMTP id ffacd0b85a97d-39c120db49bmr10278754f8f.16.1743518131768; Tue, 01 Apr 2025 07:35:31 -0700 (PDT) Received: from f.. (cst-prg-92-82.cust.vodafone.cz. [46.135.92.82]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d8fba4b4fsm161194865e9.1.2025.04.01.07.35.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Apr 2025 07:35:30 -0700 (PDT) From: Mateusz Guzik To: dave.hansen@linux.intel.com Cc: linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org, Mateusz Guzik Subject: [PATCH] x86/mm: stop prefetching the mmap semaphore on page faults Date: Tue, 1 Apr 2025 16:35:20 +0200 Message-ID: <20250401143520.1113572-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: A505AC000B X-Stat-Signature: 9hdakn7k9szrg6zoddt8pqpgc5deq5s8 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1743518133-442618 X-HE-Meta: U2FsdGVkX18nNeFmZnhhqV+EFwXcerXpJ+fbEsZZ3lSSwxuLhDUsd06+i5ZussOmwXB+EIiNvERSC2nfz+OOlqZ0G6FZUqeIhjI2go7vzvrG3PXPSh2Gr0f6acl8HXs7B0qVVMoawOiN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GyjArSe9SIPLbmnMlBzyj3/OhuSwz5LitCja1EbNPHP/0gAT1DtwvtOPL2y/EfCpXj19kicqQPaP5fKC8Pf8yKuZbX7vH737793+XootNPxJGQW3ijYqf4i/GNVGgoP6KSlujjrBZ64XXjdFb68Xv8qj+TaAa3xjFo+arQhpX0XvarwKO0OWOW 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: The prefetchw dates back decades and the fundamental notion of doing something like this on a lock is shady. Moreover, for few years now in the fast path faults are handled with RCU + per-vma locking, hopefully not even looking at the lock to begin with. As such just remove it. I did not see a point benchmarking this. Given that it is not expected to be looked at by default justifies not doing the prefetch. Signed-off-by: Mateusz Guzik --- arch/x86/mm/fault.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 296d294142c8..697432f63c59 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -13,7 +13,6 @@ #include /* kmmio_handler, ... */ #include /* perf_sw_event */ #include /* hstate_index_to_shift */ -#include /* prefetchw */ #include /* exception_enter(), ... */ #include /* faulthandler_disabled() */ #include /* efi_crash_gracefully_on_page_fault()*/ @@ -1496,8 +1495,6 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault) address = cpu_feature_enabled(X86_FEATURE_FRED) ? fred_event_data(regs) : read_cr2(); - prefetchw(¤t->mm->mmap_lock); - /* * KVM uses #PF vector to deliver 'page not present' events to guests * (asynchronous page fault mechanism). The event happens when a