[PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option

Chen Ridong posted 11 patches 1 year, 5 months ago
There is a newer version of this series
MAINTAINERS                                   |   3 +
include/linux/cpuset.h                        |   8 +-
init/Kconfig                                  |  13 +
kernel/cgroup/Makefile                        |   1 +
kernel/cgroup/cpuset-internal.h               | 307 +++++++
kernel/cgroup/cpuset-v1.c                     | 565 ++++++++++++
kernel/cgroup/cpuset.c                        | 850 +-----------------
.../selftests/cgroup/test_cpuset_v1_base.sh   |  77 ++
8 files changed, 987 insertions(+), 837 deletions(-)
create mode 100644 kernel/cgroup/cpuset-internal.h
create mode 100644 kernel/cgroup/cpuset-v1.c
create mode 100755 tools/testing/selftests/cgroup/test_cpuset_v1_base.sh
[PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option
Posted by Chen Ridong 1 year, 5 months ago
Cgroups v2 have been around for a while and many users have fully adopted
them, so they never use cgroups v1 features and functionality. Yet they
have to "pay" for the cgroup v1 support anyway:
1) the kernel binary contains an unused cgroup v1 code,
2) some code paths have additional checks which are not needed,
3) some common structures like task_struct and mem_cgroup contain unused
   cgroup v1-specific members.

Cgroup memory controller has already separated legacy code to
memory-v1.c. So it is time to do the same thing for cpuset controller.

This patchset aims to do:
1) moving cgroup v1-specific cpuset code to the new cpuset-v1.c file,
2) putting definitions shared by cpuset.c and cpuset-v1.c into the
   cpuset-internal.h header,
3) introducing the CONFIG_CPUSETS_V1 config option, turned off by default,
4) making cpuset-v1.c to compile only if CONFIG_CPUSETS_V1 is set.

This patchset is based on -next commit c79c85875f1a ("Add linux-next
specific files for 20240823") and assumes that "Some optimizations about
cpuset" series are merged, which are applied to cgroup/for-6.12.


Chen Ridong (11):
  cgroup/cpuset: introduce cpuset-v1.c
  cgroup/cpuset: move common code to cpuset-internal.h
  cgroup/cpuset: move memory_pressure to cpuset-v1.c
  cgroup/cpuset: move relax_domain_level to cpuset-v1.c
  cgroup/cpuset: move memory_spread to cpuset-v1.c
  cgroup/cpuset: add callback_lock helper
  cgroup/cpuset: move legacy hotplug update to cpuset-v1.c
  cgroup/cpuset: move validate_change_legacy to cpuset-v1.c
  cgroup/cpuset: move v1 interfaces to cpuset-v1.c
  cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1
  cgroup/cpuset: add sefltest for cpuset v1

 MAINTAINERS                                   |   3 +
 include/linux/cpuset.h                        |   8 +-
 init/Kconfig                                  |  13 +
 kernel/cgroup/Makefile                        |   1 +
 kernel/cgroup/cpuset-internal.h               | 307 +++++++
 kernel/cgroup/cpuset-v1.c                     | 565 ++++++++++++
 kernel/cgroup/cpuset.c                        | 850 +-----------------
 .../selftests/cgroup/test_cpuset_v1_base.sh   |  77 ++
 8 files changed, 987 insertions(+), 837 deletions(-)
 create mode 100644 kernel/cgroup/cpuset-internal.h
 create mode 100644 kernel/cgroup/cpuset-v1.c
 create mode 100755 tools/testing/selftests/cgroup/test_cpuset_v1_base.sh

-- 
2.34.1
Re: [PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option
Posted by Waiman Long 1 year, 5 months ago
On 8/23/24 06:00, Chen Ridong wrote:
> Cgroups v2 have been around for a while and many users have fully adopted
> them, so they never use cgroups v1 features and functionality. Yet they
> have to "pay" for the cgroup v1 support anyway:
> 1) the kernel binary contains an unused cgroup v1 code,
> 2) some code paths have additional checks which are not needed,
> 3) some common structures like task_struct and mem_cgroup contain unused
>     cgroup v1-specific members.
>
> Cgroup memory controller has already separated legacy code to
> memory-v1.c. So it is time to do the same thing for cpuset controller.
>
> This patchset aims to do:
> 1) moving cgroup v1-specific cpuset code to the new cpuset-v1.c file,
> 2) putting definitions shared by cpuset.c and cpuset-v1.c into the
>     cpuset-internal.h header,
> 3) introducing the CONFIG_CPUSETS_V1 config option, turned off by default,
> 4) making cpuset-v1.c to compile only if CONFIG_CPUSETS_V1 is set.
>
> This patchset is based on -next commit c79c85875f1a ("Add linux-next
> specific files for 20240823") and assumes that "Some optimizations about
> cpuset" series are merged, which are applied to cgroup/for-6.12.
>
>
> Chen Ridong (11):
>    cgroup/cpuset: introduce cpuset-v1.c
>    cgroup/cpuset: move common code to cpuset-internal.h
>    cgroup/cpuset: move memory_pressure to cpuset-v1.c
>    cgroup/cpuset: move relax_domain_level to cpuset-v1.c
>    cgroup/cpuset: move memory_spread to cpuset-v1.c
>    cgroup/cpuset: add callback_lock helper
>    cgroup/cpuset: move legacy hotplug update to cpuset-v1.c
>    cgroup/cpuset: move validate_change_legacy to cpuset-v1.c
>    cgroup/cpuset: move v1 interfaces to cpuset-v1.c
>    cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1
>    cgroup/cpuset: add sefltest for cpuset v1
>
>   MAINTAINERS                                   |   3 +
>   include/linux/cpuset.h                        |   8 +-
>   init/Kconfig                                  |  13 +
>   kernel/cgroup/Makefile                        |   1 +
>   kernel/cgroup/cpuset-internal.h               | 307 +++++++
>   kernel/cgroup/cpuset-v1.c                     | 565 ++++++++++++
>   kernel/cgroup/cpuset.c                        | 850 +-----------------
>   .../selftests/cgroup/test_cpuset_v1_base.sh   |  77 ++
>   8 files changed, 987 insertions(+), 837 deletions(-)
>   create mode 100644 kernel/cgroup/cpuset-internal.h
>   create mode 100644 kernel/cgroup/cpuset-v1.c
>   create mode 100755 tools/testing/selftests/cgroup/test_cpuset_v1_base.sh
>
Patch 2 doesn't apply to the latest cgroup/for-6.12 branch of the cgroup 
tree. You will have to update the patch series.

Cheers,
Longman
Re: [PATCH v1 -next 00/11] cgroup:cpuset:separate legacy cgroup v1 code and put under config option
Posted by chenridong 1 year, 5 months ago

On 2024/8/26 1:20, Waiman Long wrote:
> On 8/23/24 06:00, Chen Ridong wrote:
>> Cgroups v2 have been around for a while and many users have fully adopted
>> them, so they never use cgroups v1 features and functionality. Yet they
>> have to "pay" for the cgroup v1 support anyway:
>> 1) the kernel binary contains an unused cgroup v1 code,
>> 2) some code paths have additional checks which are not needed,
>> 3) some common structures like task_struct and mem_cgroup contain unused
>>     cgroup v1-specific members.
>>
>> Cgroup memory controller has already separated legacy code to
>> memory-v1.c. So it is time to do the same thing for cpuset controller.
>>
>> This patchset aims to do:
>> 1) moving cgroup v1-specific cpuset code to the new cpuset-v1.c file,
>> 2) putting definitions shared by cpuset.c and cpuset-v1.c into the
>>     cpuset-internal.h header,
>> 3) introducing the CONFIG_CPUSETS_V1 config option, turned off by 
>> default,
>> 4) making cpuset-v1.c to compile only if CONFIG_CPUSETS_V1 is set.
>>
>> This patchset is based on -next commit c79c85875f1a ("Add linux-next
>> specific files for 20240823") and assumes that "Some optimizations about
>> cpuset" series are merged, which are applied to cgroup/for-6.12.
>>
>>
>> Chen Ridong (11):
>>    cgroup/cpuset: introduce cpuset-v1.c
>>    cgroup/cpuset: move common code to cpuset-internal.h
>>    cgroup/cpuset: move memory_pressure to cpuset-v1.c
>>    cgroup/cpuset: move relax_domain_level to cpuset-v1.c
>>    cgroup/cpuset: move memory_spread to cpuset-v1.c
>>    cgroup/cpuset: add callback_lock helper
>>    cgroup/cpuset: move legacy hotplug update to cpuset-v1.c
>>    cgroup/cpuset: move validate_change_legacy to cpuset-v1.c
>>    cgroup/cpuset: move v1 interfaces to cpuset-v1.c
>>    cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1
>>    cgroup/cpuset: add sefltest for cpuset v1
>>
>>   MAINTAINERS                                   |   3 +
>>   include/linux/cpuset.h                        |   8 +-
>>   init/Kconfig                                  |  13 +
>>   kernel/cgroup/Makefile                        |   1 +
>>   kernel/cgroup/cpuset-internal.h               | 307 +++++++
>>   kernel/cgroup/cpuset-v1.c                     | 565 ++++++++++++
>>   kernel/cgroup/cpuset.c                        | 850 +-----------------
>>   .../selftests/cgroup/test_cpuset_v1_base.sh   |  77 ++
>>   8 files changed, 987 insertions(+), 837 deletions(-)
>>   create mode 100644 kernel/cgroup/cpuset-internal.h
>>   create mode 100644 kernel/cgroup/cpuset-v1.c
>>   create mode 100755 
>> tools/testing/selftests/cgroup/test_cpuset_v1_base.sh
>>
> Patch 2 doesn't apply to the latest cgroup/for-6.12 branch of the cgroup 
> tree. You will have to update the patch series.
> 
> Cheers,
> Longman
> 
> 

Thanks, I will update soon.

Thanks,
Ridong