• Peter Zijlstra's avatar
    nohz/full, sched/rt: Fix missed tick-reenabling bug in sched_can_stop_tick() · 2548d546
    Peter Zijlstra authored
    Chris Metcalf reported a that sched_can_stop_tick() sometimes fails to
    re-enable the tick.
    
    His observed problem is that rq->cfs.nr_running can be 1 even though
    there are multiple runnable CFS tasks. This happens in the cgroup
    case, in which case cfs.nr_running is the number of runnable entities
    for that level.
    
    If there is a single runnable cgroup (which can have an arbitrary
    number of runnable child entries itself) rq->cfs.nr_running will be 1.
    
    However, looking at that function I think there's more problems with it.
    
    It seems to assume that if there's FIFO tasks, those will run. This is
    incorrect. The FIFO task can have a lower prio than an RR task, in which
    case the RR task will run.
    
    So the whole fifo_nr_running test seems misplaced, it should go after
    the rr_nr_running tests. That is, only if !rr_nr_running, can we use
    fifo_nr_running like this.
    Reported-by: default avatarChris Metcalf <cmetcalf@mellanox.com>
    Tested-by: default avatarChris Metcalf <cmetcalf@mellanox.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Christoph Lameter <cl@linux.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Luiz Capitulino <lcapitulino@redhat.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: Viresh Kumar <viresh.kumar@linaro.org>
    Cc: Wanpeng Li <kernellwp@gmail.com>
    Fixes: 76d92ac3 ("sched: Migrate sched to use new tick dependency mask model")
    Link: http://lkml.kernel.org/r/20160421160315.GK24771@twins.programming.kicks-ass.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    2548d546
core.c 206 KB