Re: [RFC PATCH 1/2] mm/swap, memcg: basic structure and logic for per cgroup swap priority control

Michal Koutný
2025-06-17T12:23:15Z

[-- Attachment #1: Type: text/plain, Size: 1215 bytes --]

Hello.

On Thu, Jun 12, 2025 at 07:37:43PM +0900, youngjun.park@lge.com wrote:
> Example:
> cat memory.swap.priority
> Inactive
> /dev/sdb unique:1 prio:10
> /dev/sdc unique:2 prio:5
>
> - Creation
> echo "unique id of swapdev 1: priority, unique id of swapdev 2: priority ..."
> > memory.swap.priority
>
> - Destruction
> Reset through the memory.swap.priority interface.
> Example: echo "" > memory.swap.priority
>
> And also be destroyed when the mem_cgroup is removed.
>
> 3. Priority Mechanism
>
> - Follows the original concept of swap priority.
> (This includes automatic binding of swap devices to NUMA nodes.)

How is this supposed to work
cg1 /dev/sda prio:10
/dev/sdb prio:5
` cg3 /dev/sda prio:5
/dev/sdb prio:10
cg2 /dev/sda prio:5
/dev/sdb prio:10
` cg4 /dev/sda prio:10
/dev/sdb prio:5

when there are competitors from cg3 and cg4? Which device should be
preferred by each cgroup?

Interface note -- try to make it "Nested keyed" or "Flat keyed" as
described in Documentation/admin-guide/cgroup-v2.rst (like io.max or
io.weight), so that it is consistent with other cgroup v2 APIs.

HTH,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]