Re: [PATCH] perf: Remove setting of page->index and ->mapping

Matthew Wilcox
2024-08-16T17:51:26Z

On Fri, Aug 16, 2024 at 02:35:39PM +0800, kernel test robot wrote:
> from commit message, it seems just some useless setting have been removed.
> but quite some performance regression bisect by our bot finally point to this
> change (already removed some not so significant changes to avoid this report
> mail is too long).
>
> we don't have enough knowledge to explain these, so just report FYI.
> if you have any suggestion for our tests or need us run more tests, please
> just let us know. thanks a lot!

Can you try this replacement patch?

diff --git a/kernel/events/core.c b/kernel/events/core.c
index c973e3c11e03..bc12f4fb7fa9 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6221,10 +6221,9 @@ static vm_fault_t perf_mmap_fault(struct vm_fault *vmf)
goto unlock;

get_page(vmf->page);
- vmf->page->mapping = vmf->vma->vm_file->f_mapping;
- vmf->page->index = vmf->pgoff;
+ lock_page(vmf->page);

- ret = 0;
+ ret = VM_FAULT_LOCKED;
unlock:
rcu_read_unlock();