lkml.org 
[lkml]   [2021]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
Subject[mel:sched-sisdepth-v1r3 3/3] kernel/sched/fair.c:6287:4: warning: Value stored to 'nr' is never read [clang-analyzer-deadcode.DeadStores]
From
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mel/linux.git sched-sisdepth-v1r3
head: 29b51054eca8c8c58122830b8a747df1a4605045
commit: 29b51054eca8c8c58122830b8a747df1a4605045 [3/3] SIS_DEPTH
config: riscv-randconfig-c006-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
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://git.kernel.org/pub/scm/linux/kernel/git/mel/linux.git/commit/?id=29b51054eca8c8c58122830b8a747df1a4605045
git remote add mel https://git.kernel.org/pub/scm/linux/kernel/git/mel/linux.git
git fetch --no-tags mel sched-sisdepth-v1r3
git checkout 29b51054eca8c8c58122830b8a747df1a4605045
# save the attached .config to linux build tree
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 <yujie.liu@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)

>> kernel/sched/fair.c:6287:4: warning: Value stored to 'nr' is never read [clang-analyzer-deadcode.DeadStores]
nr *= sched_smt_weight;
^

vim +/nr +6287 kernel/sched/fair.c

8335aa1277b644 Mel Gorman 2021-06-17 6265
10e2f1acd0106c Peter Zijlstra 2016-05-09 6266 /*
10e2f1acd0106c Peter Zijlstra 2016-05-09 6267 * Scan the LLC domain for idle CPUs; this is dynamically regulated by
29b51054eca8c8 Mel Gorman 2021-10-11 6268 * the success or failure of previous scans;
10e2f1acd0106c Peter Zijlstra 2016-05-09 6269 */
c722f35b513f80 Rik van Riel 2021-03-26 6270 static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, bool has_idle_core, int target)
10e2f1acd0106c Peter Zijlstra 2016-05-09 6271 {
60588bfa223ff6 Cheng Jian 2019-12-13 6272 struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask);
9fe1f127b91331 Mel Gorman 2021-01-27 6273 int i, cpu, idle_cpu = -1, nr = INT_MAX;
9cfb38a7ba5a9c Wanpeng Li 2016-10-09 6274 struct sched_domain *this_sd;
29b51054eca8c8 Mel Gorman 2021-10-11 6275 int depth = 0;
10e2f1acd0106c Peter Zijlstra 2016-05-09 6276
9cfb38a7ba5a9c Wanpeng Li 2016-10-09 6277 this_sd = rcu_dereference(*this_cpu_ptr(&sd_llc));
9cfb38a7ba5a9c Wanpeng Li 2016-10-09 6278 if (!this_sd)
9cfb38a7ba5a9c Wanpeng Li 2016-10-09 6279 return -1;
9cfb38a7ba5a9c Wanpeng Li 2016-10-09 6280
bae4ec13640b09 Mel Gorman 2021-01-25 6281 cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
bae4ec13640b09 Mel Gorman 2021-01-25 6282
29b51054eca8c8 Mel Gorman 2021-10-11 6283 if (sched_feat(SIS_DEPTH)) {
29b51054eca8c8 Mel Gorman 2021-10-11 6284 depth = min_t(int, this_sd->sis_scan_depth, nr);
1ad3aaf3fcd244 Peter Zijlstra 2017-05-17 6285
b1168d8cf90943 Mel Gorman 2021-06-18 6286 if (!has_idle_core)
8335aa1277b644 Mel Gorman 2021-06-17 @6287 nr *= sched_smt_weight;
29b51054eca8c8 Mel Gorman 2021-10-11 6288 nr = depth;
bae4ec13640b09 Mel Gorman 2021-01-25 6289 }
60588bfa223ff6 Cheng Jian 2019-12-13 6290
29b51054eca8c8 Mel Gorman 2021-10-11 6291 cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr);
29b51054eca8c8 Mel Gorman 2021-10-11 6292
56498cfb045d71 Mel Gorman 2021-08-04 6293 for_each_cpu_wrap(cpu, cpus, target + 1) {
29b51054eca8c8 Mel Gorman 2021-10-11 6294 if (--nr < 0) {
29b51054eca8c8 Mel Gorman 2021-10-11 6295 depth = clamp(depth - 1, 1, sis_min_cores * sched_smt_weight);
b1168d8cf90943 Mel Gorman 2021-06-18 6296 break;
29b51054eca8c8 Mel Gorman 2021-10-11 6297 }
b1168d8cf90943 Mel Gorman 2021-06-18 6298
c722f35b513f80 Rik van Riel 2021-03-26 6299 if (has_idle_core) {
9fe1f127b91331 Mel Gorman 2021-01-27 6300 i = select_idle_core(p, cpu, cpus, &idle_cpu);
9fe1f127b91331 Mel Gorman 2021-01-27 6301 if ((unsigned int)i < nr_cpumask_bits)
b1168d8cf90943 Mel Gorman 2021-06-18 6302 break;
9fe1f127b91331 Mel Gorman 2021-01-27 6303 } else {
97886d9dcd8682 Aubrey Li 2021-03-24 6304 idle_cpu = __select_idle_cpu(cpu, p);
9fe1f127b91331 Mel Gorman 2021-01-27 6305 if ((unsigned int)idle_cpu < nr_cpumask_bits)
10e2f1acd0106c Peter Zijlstra 2016-05-09 6306 break;
10e2f1acd0106c Peter Zijlstra 2016-05-09 6307 }
9fe1f127b91331 Mel Gorman 2021-01-27 6308 }
10e2f1acd0106c Peter Zijlstra 2016-05-09 6309
29b51054eca8c8 Mel Gorman 2021-10-11 6310 if ((unsigned int)idle_cpu < nr_cpumask_bits && has_idle_core)
02dbb7246c5bbb Gautham R. Shenoy 2021-05-11 6311 set_idle_cores(target, false);
9fe1f127b91331 Mel Gorman 2021-01-27 6312
29b51054eca8c8 Mel Gorman 2021-10-11 6313 if (sched_feat(SIS_DEPTH)) {
29b51054eca8c8 Mel Gorman 2021-10-11 6314 if (idle_cpu)
29b51054eca8c8 Mel Gorman 2021-10-11 6315 depth = min_t(int, depth + 1, sd->span_weight / sched_smt_weight);
29b51054eca8c8 Mel Gorman 2021-10-11 6316 if (this_sd->sis_scan_depth != depth)
29b51054eca8c8 Mel Gorman 2021-10-11 6317 this_sd->sis_scan_depth = depth;
b1168d8cf90943 Mel Gorman 2021-06-18 6318 }
10e2f1acd0106c Peter Zijlstra 2016-05-09 6319
9fe1f127b91331 Mel Gorman 2021-01-27 6320 return idle_cpu;
10e2f1acd0106c Peter Zijlstra 2016-05-09 6321 }
10e2f1acd0106c Peter Zijlstra 2016-05-09 6322

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-11-24 04:51    [W:0.033 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site