* [to-be-updated] filemap-optimize-order0-folio-in-filemap_map_pages.patch removed from -mm tree
@ 2025-09-03 4:55 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-09-03 4:55 UTC (permalink / raw)
To: mm-commits, willy, wangkefeng.wang, fengwei.yin, david,
tujinjiang, akpm
The quilt patch titled
Subject: filemap: optimize order0 folio in filemap_map_pages
has been removed from the -mm tree. Its filename was
filemap-optimize-order0-folio-in-filemap_map_pages.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Jinjiang Tu <tujinjiang@huawei.com>
Subject: filemap: optimize order0 folio in filemap_map_pages
Date: Tue, 19 Aug 2025 22:06:53 +0800
There are two meaningless folio refcount updates for order 0 folio in
filemap_map_pages(). First, filemap_map_order0_folio() adds folio
refcount after the folio is mapped to pte. And then, filemap_map_pages()
drops a refcount grabbed by next_uptodate_folio(). We could remain the
refcount unchanged in this case.
With this patch, we can get 8% performance gain for lmbench testcase
'lat_pagefault -P 1 file', the size of file is 512M.
Link: https://lkml.kernel.org/r/20250819140653.3229136-1-tujinjiang@huawei.com
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Fengwei Yin <fengwei.yin@intel.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/filemap.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--- a/mm/filemap.c~filemap-optimize-order0-folio-in-filemap_map_pages
+++ a/mm/filemap.c
@@ -3719,6 +3719,8 @@ skip:
}
vmf->pte = old_ptep;
+ folio_unlock(folio);
+ folio_put(folio);
return ret;
}
@@ -3731,7 +3733,7 @@ static vm_fault_t filemap_map_order0_fol
struct page *page = &folio->page;
if (PageHWPoison(page))
- return ret;
+ goto out;
/* See comment of filemap_map_folio_range() */
if (!folio_test_workingset(folio))
@@ -3743,15 +3745,19 @@ static vm_fault_t filemap_map_order0_fol
* the fault-around logic.
*/
if (!pte_none(ptep_get(vmf->pte)))
- return ret;
+ goto out;
if (vmf->address == addr)
ret = VM_FAULT_NOPAGE;
set_pte_range(vmf, folio, page, 1, addr);
(*rss)++;
- folio_ref_inc(folio);
+ folio_unlock(folio);
+ return ret;
+out:
+ folio_unlock(folio);
+ folio_put(folio);
return ret;
}
@@ -3809,9 +3815,6 @@ vm_fault_t filemap_map_pages(struct vm_f
ret |= filemap_map_folio_range(vmf, folio,
xas.xa_index - folio->index, addr,
nr_pages, &rss, &mmap_miss);
-
- folio_unlock(folio);
- folio_put(folio);
} while ((folio = next_uptodate_folio(&xas, mapping, end_pgoff)) != NULL);
add_mm_counter(vma->vm_mm, folio_type, rss);
pte_unmap_unlock(vmf->pte, vmf->ptl);
_
Patches currently in -mm which might be from tujinjiang@huawei.com are
mm-memory_hotplug-fix-hwpoisoned-large-folio-handling-in-do_migrate_range.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-03 4:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-03 4:55 [to-be-updated] filemap-optimize-order0-folio-in-filemap_map_pages.patch removed from -mm tree Andrew Morton
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).