Skip to content

mm: skip memcg for certain address space

Qu Wenruo cgroups linux-btrfs linux-fsdevel linux-mm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2mm: make lru_gen_eviction() to handle folios without memcg infomm/workingset.c+1 -10 replies
2/2mm: allow certain address space to be not accounted by memcgfs/btrfs/disk-io.c include/linux/pagemap.h mm/filemap.c+11 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] mm: skip memcg for certain address space

Recently I'm hitting soft lockup if adding an order 2 folio to a filemap using GFP_NOFS | __GFP_NOFAIL. The softlockup happens at memcg charge code, and I guess that's exactly what __GFP_NOFAIL is expected to do, wait indefinitely until the request can be met.

On the other hand, if we do not use __GFP_NOFAIL, we can be limited by memcg at a lot of critical location, and lead to unnecessary transaction abort just due to memcg limit.

However for that specific btrfs call site, there is really no need charge the memcg, as that address space belongs to btree inode, which is not accessible to any end user, and that btree inode is a shared pool for all metadata of a btrfs.

So this patchset introduces a new address space flag, AS_NO_MEMCG, so that folios added to that address space will not trigger any memcg charge.

This would be the basis for future btrfs changes, like removing __GFP_NOFAIL completely and larger metadata folios.

Qu Wenruo (2):
mm: make lru_gen_eviction() to handle folios without memcg info
mm: allow certain address space to be not accounted by memcg

 fs/btrfs/disk-io.c      |  1 +
 include/linux/pagemap.h |  1 +
 mm/filemap.c            | 12 +++++++++---
 mm/workingset.c         |  2 +-
 4 files changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.45.2