Skip to contentSkip to conversation

cgroup/dmem: Select PAGE_COUNTER

PATCH Applied Maxime Ripard 3 participants 9 messages Jan 13, 2025 – Jan 15, 2025

Subsystems (5)
lore
Share & tools
lore

Maxime Ripard

author maintainer
#0 lore raw

PATCH 1/4 cgroup/dmem: Select PAGE_COUNTER

The dmem cgroup the page counting API implemented behing the PAGE_COUNTER kconfig option. However, it doesn't select it, resulting in potential build breakages. Select PAGE_COUNTER.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
---
 init/Kconfig | 1 +
 1 file changed, 1 insertion(+)
init/Kconfig +1 -0
index 61f50cafa815..5e5328506138 100644
@@ -1137,10 +1137,11 @@ config CGROUP_RDMA
 	  Attaching processes with active RDMA resources to the cgroup
 	  hierarchy is allowed even if can cross the hierarchy's limit.
 
 config CGROUP_DMEM
 	bool "Device memory controller (DMEM)"
+	select PAGE_COUNTER
 	help
 	  The DMEM controller allows compatible devices to restrict device
 	  memory usage based on the cgroup hierarchy.
 
 	  As an example, it allows you to restrict VRAM usage for applications
Signature · 1 line
2.47.1
author maintainer
#1 lore raw

PATCH 2/4 cgroup/dmem: Fix parameters documentation

During the dmem cgroup development, the parameters to the dmem_cgroup_state_evict_valuable() and dmem_cgroup_try_charge() were changed, but the documentation wasn't adjusted accordingly.

This results in a documentation build warning. Adjust the documentation to reflect what the final functions parameters are.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
---
 kernel/cgroup/dmem.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
kernel/cgroup/dmem.c +2 -5
index 52736ef0ccf2..ecea58abed6a 100644
@@ -278,12 +278,10 @@ dmem_cgroup_calculate_protection(struct dmem_cgroup_pool_state *limit_pool,
 	rcu_read_unlock();
 }
 
 /**
  * dmem_cgroup_state_evict_valuable() - Check if we should evict from test_pool
- * @dev: &dmem_cgroup_region
- * @index: The index number of the region being tested.
  * @limit_pool: The pool for which we hit limits
  * @test_pool: The pool for which to test
  * @ignore_low: Whether we have to respect low watermarks.
  * @ret_hit_low: Pointer to whether it makes sense to consider low watermark.
  *
@@ -609,17 +607,16 @@ void dmem_cgroup_uncharge(struct dmem_cgroup_pool_state *pool, u64 size)
 }
 EXPORT_SYMBOL_GPL(dmem_cgroup_uncharge);
 
 /**
  * dmem_cgroup_try_charge() - Try charging a new allocation to a region.
- * @dev: Device to charge
+ * @region: dmem region to charge
  * @size: Size (in bytes) to charge.
  * @ret_pool: On succesfull allocation, the pool that is charged.
  * @ret_limit_pool: On a failed allocation, the limiting pool.
  *
- * This function charges the current pool for @dev with region at @index for a
- * size of @size bytes.
+ * This function charges the @region region for a size of @size bytes.
  *
  * If the function succeeds, @ret_pool is set, which must be passed to
  * dmem_cgroup_uncharge() when undoing the allocation.
  *
  * When this function fails with -EAGAIN and @ret_limit_pool is non-null, it
Signature · 1 line
2.47.1
author maintainer
#2 lore raw

PATCH 3/4 drm/doc: Include new drm-compute documentation

In reply to Maxime Ripard

Commit b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup") introduced a new documentation file, but didn't link it anywhere. It was thus triggering a documentation build warning. Make sure it's included as part of the DRM documentation.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
---
 Documentation/gpu/index.rst | 1 +
 1 file changed, 1 insertion(+)
Documentation/gpu/index.rst +1 -0
index 37e383ccf73f..7dcb15850afd 100644
@@ -11,10 +11,11 @@ GPU Driver Developer's Guide
    drm-kms-helpers
    drm-uapi
    drm-usage-stats
    driver-uapi
    drm-client
+   drm-compute
    drivers
    backlight
    vga-switcheroo
    vgaarbiter
    automated_testing
Signature · 1 line
2.47.1
author maintainer
#3 lore raw

PATCH 4/4 doc/cgroup: Fix title underline length

In reply to Maxime Ripard

Commit

Commit b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup") introduced a new documentation file, with a shorter than expected underline. This results in a documentation build warning. Fix that underline length.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
---
 Documentation/core-api/cgroup.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/core-api/cgroup.rst +1 -1
index 8696e9513f51..734ea21e1e17 100644
@@ -1,9 +1,9 @@
 ==================
 Cgroup Kernel APIs
 ==================
 
 Device Memory Cgroup API (dmemcg)
-=========================
+=================================
 .. kernel-doc:: kernel/cgroup/dmem.c
    :export:
 
Signature · 1 line
2.47.1
Reviewed-by on v1 4/4
#4 lore raw

Re: [PATCH 4/4] doc/cgroup: Fix title underline length

Quoted 11 lines · Maxime Ripard

Commit

Commit b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup") introduced a new documentation file, with a shorter than expected underline. This results in a documentation build warning. Fix that underline length.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")

On the three doc patches:

Quoted 22 lines
---
 Documentation/core-api/cgroup.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/core-api/cgroup.rst +1 -1
index 8696e9513f51..734ea21e1e17 100644
@@ -1,9 +1,9 @@
 ==================
 Cgroup Kernel APIs
 ==================
 
 Device Memory Cgroup API (dmemcg)
-=========================
+=================================
 .. kernel-doc:: kernel/cgroup/dmem.c
    :export:
 
Signature · 1 line
2.47.1
Signature · 3 lines
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Reviewed-by on v1 1/4
#5 lore raw
In reply to Maxime Ripard
Quoted 8 lines · Maxime Ripard

The dmem cgroup the page counting API implemented behing the PAGE_COUNTER kconfig option. However, it doesn't select it, resulting in potential build breakages. Select PAGE_COUNTER.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
Quoted 23 lines
---
 init/Kconfig | 1 +
 1 file changed, 1 insertion(+)
init/Kconfig +1 -0
index 61f50cafa815..5e5328506138 100644
@@ -1137,10 +1137,11 @@ config CGROUP_RDMA
 	  Attaching processes with active RDMA resources to the cgroup
 	  hierarchy is allowed even if can cross the hierarchy's limit.
 
 config CGROUP_DMEM
 	bool "Device memory controller (DMEM)"
+	select PAGE_COUNTER
 	help
 	  The DMEM controller allows compatible devices to restrict device
 	  memory usage based on the cgroup hierarchy.
 
 	  As an example, it allows you to restrict VRAM usage for applications
Signature · 1 line
2.47.1
Signature · 3 lines
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
author maintainer
#6 lore raw
Quoted 11 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard

The dmem cgroup the page counting API implemented behing the PAGE_COUNTER kconfig option. However, it doesn't select it, resulting in potential build breakages. Select PAGE_COUNTER.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")

These patches have been pulled as a separate PR into drm-next, and I'm not sure how we should merge these patches.

Obviously, we'd need Tejun's, Johannes', or Michal's ack, but should we backmerged drm-next into drm-misc-next-fixes and apply them there?

Maxime

maintainer Acked-by
#7 lore raw
Quoted 11 lines · Maxime Ripard
Quoted 10 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard

The dmem cgroup the page counting API implemented behing the PAGE_COUNTER kconfig option. However, it doesn't select it, resulting in potential build breakages. Select PAGE_COUNTER.

Fixes b168ed458dde ("kernel/cgroup: Add "dmem" memory accounting cgroup")
Quoted 7 lines
Quoted 1 line

These patches have been pulled as a separate PR into drm-next, and I'm not sure how we should merge these patches.

Obviously, we'd need Tejun's, Johannes', or Michal's ack, but should we backmerged drm-next into drm-misc-next-fixes and apply them there?

Please route them with the existing dmem patches.

Thanks.

Signature · 1 line
tejun
author maintainer Applied
#8 lore raw
In reply to Maxime Ripard
Quoted 5 lines · Maxime Ripard

The dmem cgroup the page counting API implemented behing the PAGE_COUNTER kconfig option. However, it doesn't select it, resulting in potential build breakages. Select PAGE_COUNTER.

Applied to misc/kernel.git (drm-misc-next-fixes).

Thanks!
Maxime