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

Michal Koutný
2025-07-07T09:59:56Z

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

Hello.

On Tue, Jul 01, 2025 at 10:08:46PM +0900, YoungJun Park <youngjun.park@lge.com> wrote:
> memory.swap.priority
...

> To assign priorities to swap devices in the current cgroup,
> write one or more lines in the following format:
>
> <swap_device_unique_id> <priority>

How would the user know this unique_id? (I don't see it in /proc/swaps.)

> Note:
> A special value of -1 means the swap device is completely
> excluded from use by this cgroup. Unlike the global swap
> priority, where negative values simply lower the priority,
> setting -1 here disables allocation from that device for the
> current cgroup only.

The divergence from the global semantics is little bit confusing.
There should better be a special value (like 'disabled') in the interface.
And possible second special value like 'none' that denotes the default
(for new (unconfigured) cgroups or when a new swap device is activated).

> memory.swap.priority.effective
> A read-only file showing the effective swap priority ordering
> actually applied to this cgroup, after resolving inheritance
> from ancestors.

Yes, this'd be definitely useful for troubleshooting and understanding
the configurations.

...
> In this case:
> - If no cgroup sets any configuration, the output matches the
> global `swapon` priority.
> - If an ancestor has a configuration, the child inherits it
> and ignores its own setting.

The child's priority could be capped by ancestors' instead of wholy
overwritten? (So that remains some effect both.)

Thanks,
Michal

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