CC: [email protected]
CC: [email protected]
BCC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Waiman Long <[email protected]>
TO: Tejun Heo <[email protected]>
TO: Zefan Li <[email protected]>
TO: Johannes Weiner <[email protected]>
TO: Jonathan Corbet <[email protected]>
TO: Shuah Khan <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: [email protected]
CC: Andrew Morton <[email protected]>
CC: Linux Memory Management List <[email protected]>
CC: Roman Gushchin <[email protected]>
CC: Phil Auld <[email protected]>
CC: Peter Zijlstra <[email protected]>
CC: Juri Lelli <[email protected]>
CC: Frederic Weisbecker <[email protected]>
CC: Marcelo Tosatti <[email protected]>
CC: "Michal Koutný" <[email protected]>
CC: Waiman Long <[email protected]>

Hi Waiman,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tj-cgroup/for-next]
[also build test WARNING on shuah-kselftest/next v5.18-rc6 next-20220513]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/intel-lab-lkp/linux/commits/Waiman-Long/cgroup-cpuset-cpu-partition-code-enhancements/20220510-233826
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-next
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: riscv-randconfig-c006-20220510 
(https://download.01.org/0day-ci/archive/20220514/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
18dd123c56754edf62c7042dcf23185c3727610f)
reproduce (this is a W=1 build):
        wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://github.com/intel-lab-lkp/linux/commit/ac471e6da8854bfc2a3c63e8c1bd36c7bf837550
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review 
Waiman-Long/cgroup-cpuset-cpu-partition-code-enhancements/20220510-233826
        git checkout ac471e6da8854bfc2a3c63e8c1bd36c7bf837550
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
           return sprintf(page, "%u\n", bi->tag_size);
                  ^~~~~~~
   block/blk-integrity.c:258:9: note: Call to function 'sprintf' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11
           return sprintf(page, "%u\n", bi->tag_size);
                  ^~~~~~~
   block/blk-integrity.c:263:9: warning: Call to function 'sprintf' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           return sprintf(page, "%u\n",
                  ^~~~~~~
   block/blk-integrity.c:263:9: note: Call to function 'sprintf' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11
           return sprintf(page, "%u\n",
                  ^~~~~~~
   block/blk-integrity.c:283:9: warning: Call to function 'sprintf' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 
0);
                  ^~~~~~~
   block/blk-integrity.c:283:9: note: Call to function 'sprintf' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11
           return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_VERIFY) != 
0);
                  ^~~~~~~
   block/blk-integrity.c:302:9: warning: Call to function 'sprintf' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 
0);
                  ^~~~~~~
   block/blk-integrity.c:302:9: note: Call to function 'sprintf' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11
           return sprintf(page, "%d\n", (bi->flags & BLK_INTEGRITY_GENERATE) != 
0);
                  ^~~~~~~
   block/blk-integrity.c:307:9: warning: Call to function 'sprintf' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           return sprintf(page, "%u\n",
                  ^~~~~~~
   block/blk-integrity.c:307:9: note: Call to function 'sprintf' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'sprintf_s' in case of C11
           return sprintf(page, "%u\n",
                  ^~~~~~~
   block/blk-integrity.c:437:2: warning: Call to function 'memset' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(bi, 0, sizeof(*bi));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   block/blk-integrity.c:437:2: note: Call to function 'memset' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11
           memset(bi, 0, sizeof(*bi));
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   Suppressed 55 warnings (55 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   57 warnings generated.
   include/linux/bitmap.h:252:2: warning: Null pointer passed as 2nd argument 
to memory copy function [clang-analyzer-unix.cstring.NullArg]
           memcpy(dst, src, len);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^
   kernel/cgroup/cpuset.c:3240:6: note: Left side of '&&' is true
           if (cpumask_empty(new_cpus) && !is_partition_valid(cs))
               ^
   kernel/cgroup/cpuset.c:3240:2: note: Taking true branch
           if (cpumask_empty(new_cpus) && !is_partition_valid(cs))
           ^
   kernel/cgroup/cpuset.c:3241:3: note: Calling 'cpumask_copy'
                   cpumask_copy(new_cpus, parent_cs(cs)->effective_cpus);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/cpumask.h:612:34: note: Passing null pointer value via 2nd 
parameter 'src'
           bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits);
                                           ^
   include/linux/cpumask.h:26:29: note: expanded from macro 'cpumask_bits'
   #define cpumask_bits(maskp) ((maskp)->bits)
                               ^~~~~~~~~~~~~~~
   include/linux/cpumask.h:612:2: note: Calling 'bitmap_copy'
           bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/bitmap.h:252:2: note: Null pointer passed as 2nd argument to 
memory copy function
           memcpy(dst, src, len);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^                       ~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^                    ~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^
>> kernel/cgroup/cpuset.c:2176:3: warning: Value stored to 
>> 'sched_domain_rebuilt' is never read [clang-analyzer-deadcode.DeadStores]
                   sched_domain_rebuilt = true;
                   ^                      ~~~~
   kernel/cgroup/cpuset.c:2176:3: note: Value stored to 'sched_domain_rebuilt' 
is never read
                   sched_domain_rebuilt = true;
                   ^                      ~~~~
   Suppressed 55 warnings (55 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   42 warnings generated.
   Suppressed 42 warnings (42 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   55 warnings generated.
   Suppressed 55 warnings (55 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   56 warnings generated.
   fs/reiserfs/tail_conversion.c:157:3: warning: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memset(kaddr + pgoff, 0, blk_size - total_tail);
                   ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/reiserfs/tail_conversion.c:157:3: note: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11
                   memset(kaddr + pgoff, 0, blk_size - total_tail);
                   ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   Suppressed 55 warnings (55 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   79 warnings generated.
   fs/reiserfs/journal.c:116:2: warning: Call to function 'memset' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(journal->j_hash_table, 0,
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/reiserfs/journal.c:116:2: note: Call to function 'memset' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11
           memset(journal->j_hash_table, 0,
           ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/reiserfs/journal.c:167:3: warning: Call to function 'memset' is insecure 
as it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memset(bn->data, 0, sb->s_blocksize);
                   ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/reiserfs/journal.c:167:3: note: Call to function 'memset' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11
                   memset(bn->data, 0, sb->s_blocksize);
                   ^
   include/linux/fortify-string.h:272:25: note: expanded from macro 'memset'
   #define memset(p, c, s) __fortify_memset_chk(p, c, s,                   \
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:265:2: note: expanded from macro 
'__fortify_memset_chk'
           __underlying_memset(p, c, __fortify_size);                      \
           ^~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:47:29: note: expanded from macro 
'__underlying_memset'
   #define __underlying_memset     __builtin_memset
                                   ^~~~~~~~~~~~~~~~
   fs/reiserfs/journal.c:264:3: warning: Use of memory after it is freed 
[clang-analyzer-unix.Malloc]
                   list_del(next);
                   ^
   fs/reiserfs/journal.c:1978:9: note: Calling 'do_journal_release'
           return do_journal_release(th, sb, 1);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/reiserfs/journal.c:1914:7: note: 'error' is 1
           if (!error && !sb_rdonly(sb)) {
                ^~~~~
   fs/reiserfs/journal.c:1914:13: note: Left side of '&&' is false
           if (!error && !sb_rdonly(sb)) {

vim +/sched_domain_rebuilt +2176 kernel/cgroup/cpuset.c

^1da177e4c3f41 kernel/cpuset.c        Linus Torvalds 2005-04-16  2110  
522c26348b1fc7 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2111  /**
f9da322e864e5c kernel/cgroup/cpuset.c Tom Rix        2022-03-05  2112   * 
update_prstate - update partition_root_state
522c26348b1fc7 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2113   * @cs: 
the cpuset to update
522c26348b1fc7 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2114   * 
@new_prs: new partition root state
522c26348b1fc7 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2115   * 
Return: 0 if successful, < 0 if error
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2116   *
b94f9ac79a7395 kernel/cgroup/cpuset.c Waiman Long    2021-09-09  2117   * Call 
with cpuset_rwsem held.
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2118   */
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2119  static 
int update_prstate(struct cpuset *cs, int new_prs)
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2120  {
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2121   int err 
= 0, old_prs = cs->partition_root_state;
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2122   bool 
sched_domain_rebuilt = false;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2123   struct 
cpuset *parent = parent_cs(cs);
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2124   struct 
tmpmasks tmpmask;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2125  
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2126   if 
(old_prs == new_prs)
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2127           
return 0;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2128  
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2129   /*
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2130    * For 
a previously invalid partition root, leave it at being
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2131    * 
invalid if new_prs is not "member".
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2132    */
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2133   if 
(new_prs && is_prs_invalid(old_prs)) {
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2134           
cs->partition_root_state = -new_prs;
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2135           
return 0;
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2136   }
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2137  
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2138   if 
(alloc_cpumasks(NULL, &tmpmask))
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2139           
return -ENOMEM;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2140  
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2141   if 
(!old_prs) {
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2142           
/*
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2143           
 * Turning on partition root requires setting the
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2144           
 * CS_CPU_EXCLUSIVE bit implicitly as well and cpus_allowed
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2145           
 * cannot be empty.
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2146           
 */
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2147           
if (cpumask_empty(cs->cpus_allowed)) {
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2148           
        err = 1;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2149           
        goto out;
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2150           
}
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2151  
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2152           
err = update_flag(CS_CPU_EXCLUSIVE, cs, 1);
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2153           
if (err)
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2154           
        goto out;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2155  
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2156           
err = update_parent_subparts_cpumask(cs, partcmd_enable,
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2157           
                                     NULL, &tmpmask);
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2158           
if (err) {
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2159           
        update_flag(CS_CPU_EXCLUSIVE, cs, 0);
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2160           
        goto out;
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2161           
}
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2162  
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2163           
if (new_prs == PRS_ISOLATED) {
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2164           
        /*
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2165           
         * Disable the load balance flag should not return an
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2166           
         * error unless the system is running out of memory.
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2167           
         */
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2168           
        update_flag(CS_SCHED_LOAD_BALANCE, cs, 0);
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2169           
        sched_domain_rebuilt = true;
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2170           
}
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2171   } else 
if (old_prs && new_prs) {
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2172           
/*
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2173           
 * A change in load balance state only, no change in cpumasks.
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2174           
 */
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2175           
update_flag(CS_SCHED_LOAD_BALANCE, cs, (new_prs != PRS_ISOLATED));
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10 @2176           
sched_domain_rebuilt = true;
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2177           
goto out;       /* Sched domain is rebuilt in update_flag() */
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2178   } else {
3881b86128d0be kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2179           
/*
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2180           
 * Switching back to member is always allowed even if it
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2181           
 * disables child partitions.
3881b86128d0be kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2182           
 */
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2183           
update_parent_subparts_cpumask(cs, partcmd_disable, NULL,
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2184           
                               &tmpmask);
3881b86128d0be kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2185  
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2186           
/*
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2187           
 * If there are child partitions, they will all become invalid.
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2188           
 */
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2189           
if (unlikely(cs->nr_subparts_cpus)) {
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2190           
        spin_lock_irq(&callback_lock);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2191           
        cs->nr_subparts_cpus = 0;
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2192           
        cpumask_clear(cs->subparts_cpus);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2193           
        compute_effective_cpumask(cs->effective_cpus, cs, parent);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2194           
        spin_unlock_irq(&callback_lock);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2195           
}
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2196  
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2197           
/* Turning off CS_CPU_EXCLUSIVE will not return error */
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2198           
update_flag(CS_CPU_EXCLUSIVE, cs, 0);
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2199  
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2200           
if (!is_sched_load_balance(cs)) {
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2201           
        /* Make sure load balance is on */
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2202           
        update_flag(CS_SCHED_LOAD_BALANCE, cs, 1);
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2203           
        sched_domain_rebuilt = true;
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2204           
}
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2205   }
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2206  
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2207   
update_tasks_cpumask(parent);
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2208  
4716909cc5c566 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2209   if 
(parent->child_ecpus_count)
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2210           
update_sibling_cpumasks(parent, cs, &tmpmask);
4716909cc5c566 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2211  
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2212   if 
(!sched_domain_rebuilt)
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2213           
rebuild_sched_domains_locked();
ee8dde0cd2ce78 kernel/cgroup/cpuset.c Waiman Long    2018-11-08  2214  out:
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2215   /*
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2216    * Make 
partition invalid if an error happen
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2217    */
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2218   if (err)
ac471e6da8854b kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2219           
new_prs = -new_prs;
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2220   
spin_lock_irq(&callback_lock);
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2221   
cs->partition_root_state = new_prs;
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2222   
spin_unlock_irq(&callback_lock);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2223   /*
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2224    * 
Update child cpusets, if present.
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2225    * 
Force update if switching back to member.
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2226    */
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2227   if 
(!list_empty(&cs->css.children))
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2228           
update_cpumasks_hier(cs, &tmpmask, !new_prs);
6ba34d3c73674e kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2229  
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2230   
notify_partition_change(cs, old_prs);
0f3adb8a1e5f36 kernel/cgroup/cpuset.c Waiman Long    2021-07-20  2231   
free_cpumasks(NULL, &tmpmask);
176c62d4270c63 kernel/cgroup/cpuset.c Waiman Long    2022-05-10  2232   return 
0;
^1da177e4c3f41 kernel/cpuset.c        Linus Torvalds 2005-04-16  2233  }
^1da177e4c3f41 kernel/cpuset.c        Linus Torvalds 2005-04-16  2234  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to