Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v7] cgroup/dmem: implement dmem.high soft limit with proactive reclaim
       [not found] <ak81RUK6vRZaMN2D@gsse-cloud1.jf.intel.com>
@ 2026-07-09  6:11 ` Jing Wu
  2026-07-09  9:47   ` Thomas Hellström
  0 siblings, 1 reply; 2+ messages in thread
From: Jing Wu @ 2026-07-09  6:11 UTC (permalink / raw)
  To: matthew.brost
  Cc: thomas.hellstrom, christian.koenig, ray.huang, matthew.auld,
	maarten.lankhorst, mripard, tzimmermann, airlied, simona, tj,
	hannes, mkoutny, natalie.vock, mhocko, roman.gushchin,
	shakeel.butt, muchun.song, intel-xe, dri-devel, linux-kernel,
	cgroups, linux-mm, Jing Wu

On Wed, Jul 09, 2026 at 12:44:37AM -0700, Matthew Brost wrote:
> This looks quite similar to work Thomas is doing here [1].

Thank you for the pointer, Matt.  We were not aware of Thomas's series
before your mail.  After reviewing Thomas's v7 [1], the two series turn
out to address different — and complementary — problems:

  - Thomas's series hooks a reclaim callback into the dmem.max write
    path: when an administrator lowers dmem.max below current usage, the
    kernel calls the driver's reclaim callback to bring device memory
    usage down to the new limit.  This is analogous to what happens in
    memcg when memory.max is written below current usage.

  - Our series adds dmem.high as a soft limit enforced in the charge
    path: when a successful allocation pushes a cgroup's usage above
    dmem.high, TTM proactively evicts one BO from that cgroup before
    returning.  This mirrors memory.high semantics in memcg, where
    reclaim is triggered per-allocation to keep usage below the soft
    threshold.

Both mechanisms coexist independently in memcg and serve distinct
purposes: the max write path handles capacity reconfiguration by
operators, while the high-limit path provides automatic backpressure
for workloads approaching their quota.  Having both in the dmem cgroup
controller seems correct.

> Are either of you two aware of this seemly overlapping work?

We were not, until your mail.  Now that we are, we would like to
coordinate with Thomas on a few interaction points:

  1. API intersection: Thomas's v5+ replaces the bare u64 size argument
     in dmem_cgroup_register_region() with struct dmem_cgroup_init (which
     bundles the region size, reclaim ops, and driver private data).  If
     Thomas's series lands first, we will adapt our patches to the new
     registration interface.

  2. File-level conflicts: both series modify ttm_resource.c and
     ttm_bo.c.  The changes are semantically independent and should
     compose cleanly after a rebase, whichever lands second.

Thomas, would you be open to coordinating on merge ordering?  We are
happy to rebase our dmem.high series on top of yours once it lands, or
to split out any shared infrastructure as a common prerequisite if that
helps.

Thanks,
Jing Wu

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v7] cgroup/dmem: implement dmem.high soft limit with proactive reclaim
  2026-07-09  6:11 ` [PATCH v7] cgroup/dmem: implement dmem.high soft limit with proactive reclaim Jing Wu
@ 2026-07-09  9:47   ` Thomas Hellström
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellström @ 2026-07-09  9:47 UTC (permalink / raw)
  To: Jing Wu, matthew.brost
  Cc: christian.koenig, ray.huang, matthew.auld, maarten.lankhorst,
	mripard, tzimmermann, airlied, simona, tj, hannes, mkoutny,
	natalie.vock, mhocko, roman.gushchin, shakeel.butt, muchun.song,
	intel-xe, dri-devel, linux-kernel, cgroups, linux-mm

On Thu, 2026-07-09 at 14:11 +0800, Jing Wu wrote:
> On Wed, Jul 09, 2026 at 12:44:37AM -0700, Matthew Brost wrote:
> > This looks quite similar to work Thomas is doing here [1].
> 
> Thank you for the pointer, Matt.  We were not aware of Thomas's
> series
> before your mail.  After reviewing Thomas's v7 [1], the two series
> turn
> out to address different — and complementary — problems:
> 
>   - Thomas's series hooks a reclaim callback into the dmem.max write
>     path: when an administrator lowers dmem.max below current usage,
> the
>     kernel calls the driver's reclaim callback to bring device memory
>     usage down to the new limit.  This is analogous to what happens
> in
>     memcg when memory.max is written below current usage.
> 
>   - Our series adds dmem.high as a soft limit enforced in the charge
>     path: when a successful allocation pushes a cgroup's usage above
>     dmem.high, TTM proactively evicts one BO from that cgroup before
>     returning.  This mirrors memory.high semantics in memcg, where
>     reclaim is triggered per-allocation to keep usage below the soft
>     threshold.
> 
> Both mechanisms coexist independently in memcg and serve distinct
> purposes: the max write path handles capacity reconfiguration by
> operators, while the high-limit path provides automatic backpressure
> for workloads approaching their quota.  Having both in the dmem
> cgroup
> controller seems correct.
> 
> > Are either of you two aware of this seemly overlapping work?
> 
> We were not, until your mail.  Now that we are, we would like to
> coordinate with Thomas on a few interaction points:
> 
>   1. API intersection: Thomas's v5+ replaces the bare u64 size
> argument
>      in dmem_cgroup_register_region() with struct dmem_cgroup_init
> (which
>      bundles the region size, reclaim ops, and driver private data). 
> If
>      Thomas's series lands first, we will adapt our patches to the
> new
>      registration interface.
> 
>   2. File-level conflicts: both series modify ttm_resource.c and
>      ttm_bo.c.  The changes are semantically independent and should
>      compose cleanly after a rebase, whichever lands second.
> 
> Thomas, would you be open to coordinating on merge ordering?  We are
> happy to rebase our dmem.high series on top of yours once it lands,
> or
> to split out any shared infrastructure as a common prerequisite if
> that
> helps.

Sure. Let's notify eachother of imminent merge plans. I will rebase my
series on yours if yours go in first. If needed let's look at a topic
branch that we can merge into drm or vice versa.

My work is stalled on lack of reviews ATM.

Thanks,
Thomas

> 
> Thanks,
> Jing Wu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-09 13:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ak81RUK6vRZaMN2D@gsse-cloud1.jf.intel.com>
2026-07-09  6:11 ` [PATCH v7] cgroup/dmem: implement dmem.high soft limit with proactive reclaim Jing Wu
2026-07-09  9:47   ` Thomas Hellström

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox