summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKairui Song <kasong@tencent.com>2026-02-13 18:03:32 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-04-05 13:53:00 -0700
commit37cb8cd043cbcbe5c617340cff1684cf2f68fb58 (patch)
tree3b52b799ecabe81a01ae4912c9ac467b908d2592 /include
parentc9cb94c6b85a2854ae03c874331b0880ee735441 (diff)
memcg: consolidate private id refcount get/put helpers
We currently have two different sets of helpers for getting or putting the private IDs' refcount for order 0 and large folios. This is redundant. Just use one and always acquire the refcount of the swapout folio size unless it's zero, and put the refcount using the folio size if the charge failed, since the folio size can't change. Then there is no need to update the refcount for tail pages. Same for freeing, then only one pair of get/put helper is needed now. The performance might be slightly better, too: both "inc unless zero" and "add unless zero" use the same cmpxchg implementation. For large folios, we saved an atomic operation. And for both order 0 and large folios, we saved a branch. Link: https://lkml.kernel.org/r/20260213-memcg-privid-v1-1-d8cb7afcf831@tencent.com Signed-off-by: Kairui Song <kasong@tencent.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Chen Ridong <chenridong@huaweicloud.com> Acked-by: Shakeel Butt <shakeel.butt@gmail.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions