mm: filemap: batch mm counter updating in filemap_map_pages()
authorKefeng Wang <wangkefeng.wang@huawei.com>
Fri, 12 Apr 2024 06:47:51 +0000 (14:47 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 6 May 2024 00:53:36 +0000 (17:53 -0700)
commitceca44991f3dd5a67b4e0ded6379c5e93e84cb31
tree4f7ad9b13b913f3a771cd63f9f6a697ceb420429
parent1f2d8b4421bd0da2c97fb8bad5cc85fc929fef64
mm: filemap: batch mm counter updating in filemap_map_pages()

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.

Link: https://lkml.kernel.org/r/20240412064751.119015-3-wangkefeng.wang@huawei.com
Signed-off-by: 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