From: ZhangPeng zhangpeng362@huawei.com
Like copy_pte_range()/zap_pte_range(), make mm counter batch updating in filemap_map_pages(), since folios type are same(MM_SHMEMPAGES or MM_FILEPAGES) in filemap_map_pages(), only check the first folio type is enough, the 'lat_pagefault -P 1 file' test from lmbench shows 12% improvement, and the percpu_counter_add_batch() is gone from perf flame graph.
Kefeng Wang (2): mm: move mm counter updating out of set_pte_range() mm: filemap: batch mm counter updating in filemap_map_pages()
mm/filemap.c | 17 ++++++++++++----- mm/memory.c | 8 +++++--- 2 files changed, 17 insertions(+), 8 deletions(-)