linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Mateusz Guzik <mjguzik@gmail.com>, dave.hansen@linux.intel.com
Cc: linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mm: stop prefetching the mmap semaphore on page faults
Date: Wed, 9 Apr 2025 11:25:13 +0200	[thread overview]
Message-ID: <8335de39-024f-4be5-a69f-42949dbf7b33@redhat.com> (raw)
In-Reply-To: <20250401143520.1113572-1-mjguzik@gmail.com>

On 01.04.25 16:35, Mateusz Guzik wrote:
> 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 <mjguzik@gmail.com>
> ---
>   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 <linux/mmiotrace.h>		/* kmmio_handler, ...		*/
>   #include <linux/perf_event.h>		/* perf_sw_event		*/
>   #include <linux/hugetlb.h>		/* hstate_index_to_shift	*/
> -#include <linux/prefetch.h>		/* prefetchw			*/
>   #include <linux/context_tracking.h>	/* exception_enter(), ...	*/
>   #include <linux/uaccess.h>		/* faulthandler_disabled()	*/
>   #include <linux/efi.h>			/* 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(&current->mm->mmap_lock);
> -
>   	/*
>   	 * KVM uses #PF vector to deliver 'page not present' events to guests
>   	 * (asynchronous page fault mechanism). The event happens when a

I'm sure if this would have any value, we'd get notified about it :)

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb


      parent reply	other threads:[~2025-04-09  9:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-01 14:35 [PATCH] x86/mm: stop prefetching the mmap semaphore on page faults Mateusz Guzik
2025-04-01 18:44 ` [tip: x86/mm] x86/mm: Stop prefetching current->mm->mmap_lock " tip-bot2 for Mateusz Guzik
2025-04-01 20:53 ` tip-bot2 for Mateusz Guzik
2025-04-01 21:03 ` tip-bot2 for Mateusz Guzik
2025-04-09  9:25 ` David Hildenbrand [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=8335de39-024f-4be5-a69f-42949dbf7b33@redhat.com \
    --to=david@redhat.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mjguzik@gmail.com \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).