public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt@codeblueprint.co.uk>
To: Wanpeng Li <kernellwp@gmail.com>
Cc: linux-kernel@vger.kernel.org, Wanpeng Li <wanpeng.li@hotmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] sched/fair: Update rq clock before changing a task's CPU affinity
Date: Wed, 22 Feb 2017 09:33:32 +0000	[thread overview]
Message-ID: <20170222093332.GS28416@codeblueprint.co.uk> (raw)
In-Reply-To: <1487749975-5994-1-git-send-email-wanpeng.li@hotmail.com>

On Tue, 21 Feb, at 11:52:55PM, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> 
>  ------------[ cut here ]------------
>  WARNING: CPU: 6 PID: 81 at kernel/sched/sched.h:812 set_next_entity+0x11d/0x380
>  rq->clock_update_flags < RQCF_ACT_SKIP
>  CPU: 6 PID: 81 Comm: torture_shuffle Not tainted 4.10.0+ #1
>  Hardware name: LENOVO ThinkCentre M8500t-N000/SHARKBAY, BIOS FBKTC1AUS 02/16/2016
>  Call Trace:
>   dump_stack+0x85/0xc2
>   __warn+0xcb/0xf0
>   warn_slowpath_fmt+0x5f/0x80
>   set_next_entity+0x11d/0x380
>   set_curr_task_fair+0x2b/0x60
>   do_set_cpus_allowed+0x139/0x180
>   __set_cpus_allowed_ptr+0x113/0x260
>   set_cpus_allowed_ptr+0x10/0x20
>   torture_shuffle+0xfd/0x180
>   kthread+0x10f/0x150
>   ? torture_shutdown_init+0x60/0x60
>   ? kthread_create_on_node+0x60/0x60
>   ret_from_fork+0x31/0x40
>  ---[ end trace dd94d92344cea9c6 ]---
> 
> This is triggered during boot when CONFIG_SCHED_DEBUG is enabled. The 
> task is running && !queued, so there is no rq clock update before calling 
> set_curr_task.
> 
> This patch fixes it by updating rq clock after holding rq->lock/pi_lock 
> just as what other dequeue + put_prev + enqueue + set_curr story does.
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
>  kernel/sched/core.c | 1 +
>  1 file changed, 1 insertion(+)

This looks correct. Thanks for doing it.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>

  reply	other threads:[~2017-02-22  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22  7:52 [PATCH] sched/fair: Update rq clock before changing a task's CPU affinity Wanpeng Li
2017-02-22  9:33 ` Matt Fleming [this message]
2017-02-24  9:16 ` [tip:sched/urgent] " tip-bot for Wanpeng Li

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=20170222093332.GS28416@codeblueprint.co.uk \
    --to=matt@codeblueprint.co.uk \
    --cc=kernellwp@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wanpeng.li@hotmail.com \
    /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