]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: rmap: abstract updating per-node and per-memcg stats
authorYosry Ahmed <yosryahmed@google.com>
Mon, 6 May 2024 21:13:33 +0000 (21:13 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 02:30:01 +0000 (19:30 -0700)
commit15c0536fb57fd989e24335020a443486bac01dac
tree344c09cb5999db748f746afc3b25a7c365854d93
parent5a3f572a592850e8b0a4a8668781820391a2e2e7
mm: rmap: abstract updating per-node and per-memcg stats

A lot of intricacies go into updating the stats when adding or removing
mappings: which stat index to use and which function.  Abstract this away
into a new static helper in rmap.c, __folio_mod_stat().

This adds an unnecessary call to folio_test_anon() in
__folio_add_anon_rmap() and __folio_add_file_rmap().  However, the folio
struct should already be in the cache at this point, so it shouldn't cause
any noticeable overhead.

No functional change intended.

[hughd@google.com: fix /proc/meminfo]
Link: https://lkml.kernel.org/r/49914517-dfc7-e784-fde0-0e08fafbecc2@google.com
Link: https://lkml.kernel.org/r/20240506211333.346605-1-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/rmap.c