Re: [PATCH v2] kernel/sched/fair: Fix the issue of virtual runtime conversion error

From: kernel test robot

Date: Thu May 28 2026 - 06:01:08 EST


Hi Li,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/sched/core]
[also build test WARNING on peterz-queue/sched/core linus/master v7.1-rc5 next-20260527]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Li-kunyu/kernel-sched-fair-Fix-the-issue-of-virtual-runtime-conversion-error/20260527-152554
base: tip/sched/core
patch link: https://lore.kernel.org/r/20260527072113.359604-1-likunyu10%40163.com
patch subject: [PATCH v2] kernel/sched/fair: Fix the issue of virtual runtime conversion error
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260528/202605281756.0qWgdGW5-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281756.0qWgdGW5-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281756.0qWgdGW5-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> kernel/sched/fair.c:7632:6: warning: variable 'delta' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
7632 | if (unlikely(se->load.weight != NICE_0_LOAD))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler.h:77:22: note: expanded from macro 'unlikely'
77 | # define unlikely(x) __builtin_expect(!!(x), 0)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/fair.c:7644:28: note: uninitialized use occurs here
7644 | hrtick_start(rq, (scale * delta) / 1024);
| ^~~~~
kernel/sched/fair.c:7632:2: note: remove the 'if' if its condition is always true
7632 | if (unlikely(se->load.weight != NICE_0_LOAD))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7633 | delta = div64_ul(NICE_0_LOAD * vdelta, se->load.weight);
kernel/sched/fair.c:7615:11: note: initialize the variable 'delta' to silence this warning
7615 | u64 delta;
| ^
| = 0
1 warning generated.


vim +7632 kernel/sched/fair.c

7603
7604 /**************************************************
7605 * CFS operations on tasks:
7606 */
7607
7608 #ifdef CONFIG_SCHED_HRTICK
7609 static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
7610 {
7611 struct sched_entity *se = &p->se;
7612 unsigned long scale = 1024;
7613 unsigned long util = 0;
7614 u64 vdelta;
7615 u64 delta;
7616
7617 WARN_ON_ONCE(task_rq(p) != rq);
7618
7619 if (rq->cfs.h_nr_queued <= 1)
7620 return;
7621
7622 /*
7623 * Compute time until virtual deadline
7624 */
7625 vdelta = se->deadline - se->vruntime;
7626 if ((s64)vdelta < 0) {
7627 if (task_current_donor(rq, p))
7628 resched_curr(rq);
7629 return;
7630 }
7631
> 7632 if (unlikely(se->load.weight != NICE_0_LOAD))
7633 delta = div64_ul(NICE_0_LOAD * vdelta, se->load.weight);
7634
7635 /*
7636 * Correct for instantaneous load of other classes.
7637 */
7638 util += cpu_util_irq(rq);
7639 if (util && util < 1024) {
7640 scale *= 1024;
7641 scale /= (1024 - util);
7642 }
7643
7644 hrtick_start(rq, (scale * delta) / 1024);
7645 }
7646

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki