RE: Do we still need SLAB_MEM_SPREAD (and possibly others)?

Started by Song, Xiongwei on Feb 6, 2024 · 5 messages from 3 authors · Last reply Feb 6, 2024

open the first message on its own page

Message details and related content
Adding the maintainers of cpuset of cgroup.
On Sun, 4 Feb 2024, Song, Xiongwei wrote:
quoted
Once SLAB_MEM_SPREAD is removed, IMO, cpuset.memory_spread_slab is useless.
SLAB_MEM_SPREAD does not do anything anymore. SLUB relies on the
"spreading" via the page allocator memory policies instead of doing its
own like SLAB used to do.

What does FILE_SPREAD_SLAB do? Dont see anything there either.
The FILE_SPREAD_SLAB flag is used by cpuset.memory_spread_slab with read/write operations:

In kernel/cgroup/cpuset.c, 
static struct cftype legacy_files[] = {
... snip ...
        {
                .name = "memory_spread_slab",
                .read_u64 = cpuset_read_u64,
                .write_u64 = cpuset_write_u64,
                .private = FILE_SPREAD_SLAB,
        },
... snip ...
};

Regards,
Xiongwei
Message details and related content
On 2/5/24 20:46, Song, Xiongwei wrote:
Adding the maintainers of cpuset of cgroup.
quoted
On Sun, 4 Feb 2024, Song, Xiongwei wrote:
quoted
Once SLAB_MEM_SPREAD is removed, IMO, cpuset.memory_spread_slab is useless.
SLAB_MEM_SPREAD does not do anything anymore. SLUB relies on the
"spreading" via the page allocator memory policies instead of doing its
own like SLAB used to do.

What does FILE_SPREAD_SLAB do? Dont see anything there either.
The FILE_SPREAD_SLAB flag is used by cpuset.memory_spread_slab with read/write operations:

In kernel/cgroup/cpuset.c,
static struct cftype legacy_files[] = {
... snip ...
         {
                 .name = "memory_spread_slab",
                 .read_u64 = cpuset_read_u64,
                 .write_u64 = cpuset_write_u64,
                 .private = FILE_SPREAD_SLAB,
         },
... snip ...
};
It looks like that memory_spread_slab may have effect only on the slab allocator. With the removal of the slab allocator, memory_spread_slab is now a no-op. However, the memory_spread_slab cgroupfs file is an externally visible API. So we can't just remove it as it may break existing applications. We can certainly deprecate it and advise users not to use it.

Cheers,
Longman

Message details and related content
On 2/5/24 22:16, Waiman Long wrote:
On 2/5/24 20:46, Song, Xiongwei wrote:
quoted
Adding the maintainers of cpuset of cgroup.
quoted
On Sun, 4 Feb 2024, Song, Xiongwei wrote:
quoted
Once SLAB_MEM_SPREAD is removed, IMO, cpuset.memory_spread_slab is useless.
SLAB_MEM_SPREAD does not do anything anymore. SLUB relies on the
"spreading" via the page allocator memory policies instead of doing its
own like SLAB used to do.

What does FILE_SPREAD_SLAB do? Dont see anything there either.
The FILE_SPREAD_SLAB flag is used by cpuset.memory_spread_slab with read/write operations:

In kernel/cgroup/cpuset.c,
static struct cftype legacy_files[] = {
... snip ...
         {
                 .name = "memory_spread_slab",
                 .read_u64 = cpuset_read_u64,
                 .write_u64 = cpuset_write_u64,
                 .private = FILE_SPREAD_SLAB,
         },
... snip ...
};
It looks like that memory_spread_slab may have effect only on the slab allocator. With the removal of the slab allocator, memory_spread_slab is now a no-op. However, the memory_spread_slab cgroupfs file is an externally visible API. So we can't just remove it as it may break existing applications. We can certainly deprecate it and advise users not to use it.
BTW, cpuset doesn't use SLAB_MEM_SPREAD directly. Instead it set the task's PFA_SPREAD_SLAB and let other subsystems test it to act appropriately. Other than cpuset, the latest upstream kernel doesn't check or use this flag at all.

Cheers,
Longman
Message details and related content
On 2024/2/6 11:20, Waiman Long wrote:
On 2/5/24 22:16, Waiman Long wrote:
quoted
On 2/5/24 20:46, Song, Xiongwei wrote:
quoted
Adding the maintainers of cpuset of cgroup.
quoted
On Sun, 4 Feb 2024, Song, Xiongwei wrote:
quoted
Once SLAB_MEM_SPREAD is removed, IMO, cpuset.memory_spread_slab is useless.
SLAB_MEM_SPREAD does not do anything anymore. SLUB relies on the
"spreading" via the page allocator memory policies instead of doing its
own like SLAB used to do.

What does FILE_SPREAD_SLAB do? Dont see anything there either.
The FILE_SPREAD_SLAB flag is used by cpuset.memory_spread_slab with read/write operations:

In kernel/cgroup/cpuset.c,
static struct cftype legacy_files[] = {
... snip ...
         {
                 .name = "memory_spread_slab",
                 .read_u64 = cpuset_read_u64,
                 .write_u64 = cpuset_write_u64,
                 .private = FILE_SPREAD_SLAB,
         },
... snip ...
};
It looks like that memory_spread_slab may have effect only on the slab allocator. With the removal of the slab allocator, memory_spread_slab is now a no-op. However, the memory_spread_slab cgroupfs file is an externally visible API. So we can't just remove it as it may break existing applications. We can certainly deprecate it and advise users not to use it.
BTW, cpuset doesn't use SLAB_MEM_SPREAD directly. Instead it set the task's PFA_SPREAD_SLAB and let other subsystems test it to act appropriately. Other than cpuset, the latest upstream kernel doesn't check or use this flag at all.
Ok, get it. So cpuset_do_slab_mem_spread() can be removed, but
this cpuset file interface and PFA_SPREAD_SLAB will be keeped.

Thanks.
Message details and related content
On 2/5/24 22:25, Chengming Zhou wrote:
On 2024/2/6 11:20, Waiman Long wrote:
quoted
On 2/5/24 22:16, Waiman Long wrote:
quoted
On 2/5/24 20:46, Song, Xiongwei wrote:
quoted
Adding the maintainers of cpuset of cgroup.
quoted
On Sun, 4 Feb 2024, Song, Xiongwei wrote:
quoted
Once SLAB_MEM_SPREAD is removed, IMO, cpuset.memory_spread_slab is useless.
SLAB_MEM_SPREAD does not do anything anymore. SLUB relies on the
"spreading" via the page allocator memory policies instead of doing its
own like SLAB used to do.

What does FILE_SPREAD_SLAB do? Dont see anything there either.
The FILE_SPREAD_SLAB flag is used by cpuset.memory_spread_slab with read/write operations:

In kernel/cgroup/cpuset.c,
static struct cftype legacy_files[] = {
... snip ...
          {
                  .name = "memory_spread_slab",
                  .read_u64 = cpuset_read_u64,
                  .write_u64 = cpuset_write_u64,
                  .private = FILE_SPREAD_SLAB,
          },
... snip ...
};
It looks like that memory_spread_slab may have effect only on the slab allocator. With the removal of the slab allocator, memory_spread_slab is now a no-op. However, the memory_spread_slab cgroupfs file is an externally visible API. So we can't just remove it as it may break existing applications. We can certainly deprecate it and advise users not to use it.
BTW, cpuset doesn't use SLAB_MEM_SPREAD directly. Instead it set the task's PFA_SPREAD_SLAB and let other subsystems test it to act appropriately. Other than cpuset, the latest upstream kernel doesn't check or use this flag at all.
Ok, get it. So cpuset_do_slab_mem_spread() can be removed, but
this cpuset file interface and PFA_SPREAD_SLAB will be keeped.
Yes, for now.

Cheers,
Longman
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help