aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_exchrange.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <[email protected]>2024-12-04 14:31:11 +0000
committerMaxime Ripard <[email protected]>2025-01-06 16:24:38 +0000
commitb168ed458ddecc176f3b9a1f4bcd83d7a4541c14 (patch)
treede0b28abb344e8c059fcff0e28c571eef242e49b /fs/xfs/xfs_exchrange.c
parentLinux 6.13-rc6 (diff)
downloadkernel-b168ed458ddecc176f3b9a1f4bcd83d7a4541c14.tar.gz
kernel-b168ed458ddecc176f3b9a1f4bcd83d7a4541c14.zip
kernel/cgroup: Add "dmem" memory accounting cgroup
This code is based on the RDMA and misc cgroup initially, but now uses page_counter. It uses the same min/low/max semantics as the memory cgroup as a result. There's a small mismatch as TTM uses u64, and page_counter long pages. In practice it's not a problem. 32-bits systems don't really come with >=4GB cards and as long as we're consistently wrong with units, it's fine. The device page size may not be in the same units as kernel page size, and each region might also have a different page size (VRAM vs GART for example). The interface is simple: - Call dmem_cgroup_register_region() - Use dmem_cgroup_try_charge to check if you can allocate a chunk of memory, use dmem_cgroup__uncharge when freeing it. This may return an error code, or -EAGAIN when the cgroup limit is reached. In that case a reference to the limiting pool is returned. - The limiting cs can be used as compare function for dmem_cgroup_state_evict_valuable. - After having evicted enough, drop reference to limiting cs with dmem_cgroup_pool_state_put. This API allows you to limit device resources with cgroups. You can see the supported cards in /sys/fs/cgroup/dmem.capacity You need to echo +dmem to cgroup.subtree_control, and then you can partition device memory. Co-developed-by: Friedrich Vock <[email protected]> Signed-off-by: Friedrich Vock <[email protected]> Co-developed-by: Maxime Ripard <[email protected]> Signed-off-by: Maarten Lankhorst <[email protected]> Acked-by: Tejun Heo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Maxime Ripard <[email protected]>
Diffstat (limited to 'fs/xfs/xfs_exchrange.c')
0 files changed, 0 insertions, 0 deletions