Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586019

Re: [PATCH] sched/fair: Update rq clock before changing a task's CPU affinity

From Matt Fleming <matt@codeblueprint.co.uk>
Newsgroups linux.kernel
Subject Re: [PATCH] sched/fair: Update rq clock before changing a task's CPU affinity
Date 2017-02-22 10:40 +0100
Message-ID <tdByW-7Zb-31@gated-at.bofh.it> (permalink)
References <tdA09-6IQ-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] sched/fair: Update rq clock before changing a task's CPU affinity Wanpeng Li <kernellwp@gmail.com> - 2017-02-22 09:00 +0100
  Re: [PATCH] sched/fair: Update rq clock before changing a task's CPU  affinity Matt Fleming <matt@codeblueprint.co.uk> - 2017-02-22 10:40 +0100
  [tip:sched/urgent] sched/fair: Update rq clock before changing a  task's CPU affinity tip-bot for Wanpeng Li <tipbot@zytor.com> - 2017-02-24 10:20 +0100

csiph-web