linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: vincent.guittot@linaro.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	linux-kernel@vger.kernel.org
Subject: [bug report] sched/fair: Prefer prev cpu in asymmetric wakeup path
Date: Fri, 13 Nov 2020 11:46:57 +0300	[thread overview]
Message-ID: <20201113084657.GA86197@mwanda> (raw)

Hello Vincent Guittot,

The patch b4c9c9f15649: "sched/fair: Prefer prev cpu in asymmetric
wakeup path" from Oct 29, 2020, leads to the following static checker
warning:

	kernel/sched/fair.c:6249 select_idle_sibling()
	error: uninitialized symbol 'task_util'.

kernel/sched/fair.c
  6233  static int select_idle_sibling(struct task_struct *p, int prev, int target)
  6234  {
  6235          struct sched_domain *sd;
  6236          unsigned long task_util;
  6237          int i, recent_used_cpu;
  6238  
  6239          /*
  6240           * On asymmetric system, update task utilization because we will check
  6241           * that the task fits with cpu's capacity.
  6242           */

The original comment was a bit more clear...  Perhaps "On asymmetric
system[s], [record the] task utilization because we will check that the
task [can be done within] the cpu's capacity."

  6243          if (static_branch_unlikely(&sched_asym_cpucapacity)) {
  6244                  sync_entity_load_avg(&p->se);
  6245                  task_util = uclamp_task_util(p);
  6246          }

"task_util" is not initialized on the else path.

  6247  
  6248          if ((available_idle_cpu(target) || sched_idle_cpu(target)) &&
  6249              asym_fits_capacity(task_util, target))
                                       ^^^^^^^^^
Uninitialized variable warning.

  6250                  return target;
  6251  
  6252          /*
  6253           * If the previous CPU is cache affine and idle, don't be stupid:
  6254           */
  6255          if (prev != target && cpus_share_cache(prev, target) &&
  6256              (available_idle_cpu(prev) || sched_idle_cpu(prev)) &&
  6257              asym_fits_capacity(task_util, prev))
  6258                  return prev;
  6259  
  6260          /*
  6261           * Allow a per-cpu kthread to stack with the wakee if the

regards,
dan carpenter

             reply	other threads:[~2020-11-13  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  8:46 Dan Carpenter [this message]
2020-11-13  8:56 ` [bug report] sched/fair: Prefer prev cpu in asymmetric wakeup path Vincent Guittot
2020-11-13 11:49   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201113084657.GA86197@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).