Since calc_load_fold_active() reads two variables (nr_running and nr_uninterruptible) it may race with parallel try_to_wake_up(). So it must be executed under rq::lock to prevent that. This seems to be the reason of negative calc_load_tasks, observed on several machines.
https://jira.sw.ru/browse/PSBM-68052 Signed-off-by: Kirill Tkhai <[email protected]> --- kernel/sched/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7c1c3f2fda6..2bc51b15fc7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2885,7 +2885,10 @@ void calc_load_enter_idle(void) * We're going into NOHZ mode, if there's any pending delta, fold it * into the pending idle delta. */ + + raw_spin_lock(&this_rq->lock); delta = calc_load_fold_active(this_rq); + raw_spin_unlock(&this_rq->lock); if (delta) { int idx = calc_load_write_idx(); atomic_long_add(delta, &calc_load_idle[idx]); _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
