linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v3 0/4] folio based filemap_map_pages()
@ 2023-02-03 13:16 Yin Fengwei
  2023-02-03 13:16 ` [RFC PATCH v3 1/4] filemap: add function filemap_map_folio_range() Yin Fengwei
                   ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Yin Fengwei @ 2023-02-03 13:16 UTC (permalink / raw)
  To: willy, david, linux-mm; +Cc: dave.hansen, tim.c.chen, ying.huang, fengwei.yin

Current filemap_map_pages() uses page granularity even when
underneath folio is large folio. Making it use folio based
granularity allows batched refcount, rmap and mm counter
update. Which brings performance gain.

This sereis tries to bring batched refcount, rmap and
mm counter for filemap_map_pages(). Testing with a micro
benchmark like will-it-scale.pagefault on a 48C/96T IceLake
tbox showed:
   - batched rmap brings around 15% performance gain
   - batched refcount brings around 2% performance gain

Patch 1 update filemap_map_pages() to do map based on folio
        granularity and batched refcount update

Patch 3,4,5 enable batched rmap and mm counter


Change from v2:
  - Drop patch 1 because it misses ->page_mkwrite() as Kirill
    pointed out.

  Patch 2:
    - Change page_add_file_rmap_range() to folio_add_file_rmap_range()
      as Matthew suggested
    - Remove "sub" as Matthew suggested

  Patch 3:
    - Only handle !cow case in do_set_pte_range() as David pointed out
    - Add a parameter of pte and avoid change vmf->pte in do_set_pte_range()
    - Drop do_set_pte_entry()

  Patch 4:
    - adopt the suggestion from Matthew to avoid subtracted/add vmf->pte.
      filemap_map_folio_range() doesn't update vmf->pte now. Make it easy
      to fit the filemap_map_pages() and no possible point to wrong page
      table.

Change from v1:
  - Update the struct page * parameter of *_range() to index
    in the folio as Matthew suggested
  - Fix indentations problem as Matthew pointed out
  - Add back the function comment as Matthew pointed out
  - Use nr_pages than len as Matthew pointed out
  - Add do_set_pte_range() as Matthew suggested
  - Add function comment as Ying suggested
  - Add performance test result to patch 1/2/5 commit message

  Patch 1:
    - Adapt commit message as Matthew suggested
    - Add Reviweed-by from Matthew
  Patch 3:
    - Restore general logic of page_add_file_rmap_range() to
      make patch review easier as Matthew suggested
  Patch 5:
    - Add perf data collected to understand the reason of
      performance gain

Yin Fengwei (4):
  filemap: add function filemap_map_folio_range()
  rmap: add folio_add_file_rmap_range()
  mm: add do_set_pte_range()
  filemap: batched update mm counter,rmap when map file folio

 include/linux/mm.h   |   3 ++
 include/linux/rmap.h |   2 +
 mm/filemap.c         | 101 ++++++++++++++++++++++++++++---------------
 mm/memory.c          |  59 ++++++++++++++++---------
 mm/rmap.c            |  66 ++++++++++++++++++++++------
 5 files changed, 163 insertions(+), 68 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-02-04  5:47 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-03 13:16 [RFC PATCH v3 0/4] folio based filemap_map_pages() Yin Fengwei
2023-02-03 13:16 ` [RFC PATCH v3 1/4] filemap: add function filemap_map_folio_range() Yin Fengwei
2023-02-03 13:53   ` Matthew Wilcox
2023-02-04  3:25     ` Yin, Fengwei
2023-02-03 14:17   ` Kirill A. Shutemov
2023-02-04  3:31     ` Yin, Fengwei
2023-02-03 13:16 ` [RFC PATCH v3 2/4] rmap: add folio_add_file_rmap_range() Yin Fengwei
2023-02-03 14:02   ` Matthew Wilcox
2023-02-04  3:34     ` Yin, Fengwei
2023-02-03 14:19   ` Kirill A. Shutemov
2023-02-04  3:35     ` Yin, Fengwei
2023-02-03 13:16 ` [RFC PATCH v3 3/4] mm: add do_set_pte_range() Yin Fengwei
2023-02-03 13:25   ` David Hildenbrand
2023-02-03 13:30     ` Yin, Fengwei
2023-02-03 13:34       ` David Hildenbrand
2023-02-03 13:39         ` Yin, Fengwei
2023-02-03 13:32   ` Chih-En Lin
2023-02-03 13:38     ` Yin, Fengwei
2023-02-03 14:30       ` Chih-En Lin
2023-02-04  5:47         ` Yin, Fengwei
2023-02-03 13:16 ` [RFC PATCH v3 4/4] filemap: batched update mm counter,rmap when map file folio Yin Fengwei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox