]> www.infradead.org Git - users/willy/pagecache.git/commit
filemap: Batch PTE mappings
authorYin Fengwei <fengwei.yin@intel.com>
Tue, 7 Feb 2023 17:45:21 +0000 (12:45 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 2 Aug 2023 02:53:28 +0000 (22:53 -0400)
commit90155f7b8b4f4179cdc05bbec94c177ac3663898
treeecc1f4ff7886d9feed3d152500d666b21a1450b3
parentc5ec3e9462a482e609188ba6e9248ab238457ba1
filemap: Batch PTE mappings

Call set_pte_range() once per contiguous range of the folio instead
of once per page.  This batches the updates to mm counters and the
rmap.

With a will-it-scale.page_fault3 like app (change file write
fault testing to read fault testing. Trying to upstream it to
will-it-scale at [1]) got 15% performance gain on a 48C/96T
Cascade Lake test box with 96 processes running against xfs.

Perf data collected before/after the change:
  18.73%--page_add_file_rmap
          |
           --11.60%--__mod_lruvec_page_state
                     |
                     |--7.40%--__mod_memcg_lruvec_state
                     |          |
                     |           --5.58%--cgroup_rstat_updated
                     |
                      --2.53%--__mod_lruvec_state
                                |
                                 --1.48%--__mod_node_page_state

  9.93%--page_add_file_rmap_range
         |
          --2.67%--__mod_lruvec_page_state
                    |
                    |--1.95%--__mod_memcg_lruvec_state
                    |          |
                    |           --1.57%--cgroup_rstat_updated
                    |
                     --0.61%--__mod_lruvec_state
                               |
                                --0.54%--__mod_node_page_state

The running time of __mode_lruvec_page_state() is reduced about 9%.

[1]: https://github.com/antonblanchard/will-it-scale/pull/37

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
mm/filemap.c