Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2827275pxv; Mon, 12 Jul 2021 02:56:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxx6ok5S7uyYrWXFioVnDHhFfz9AYYNa6HQb84i/rt61Fr00nLCG66YwOPlc7fyWnFvaaLZ X-Received: by 2002:a6b:5f0b:: with SMTP id t11mr34895363iob.111.1626083771699; Mon, 12 Jul 2021 02:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626083771; cv=none; d=google.com; s=arc-20160816; b=fG4gzTn+P0DsOlyXDEOz6OttsXV+v2pTkWg3uuH8fiXzqMv7KDDMijXFIDw+PU41O8 jeqdmHsGXVrtam4Ixkm/PaaUQFA2NtExOoi6+mePKmIK0Z1boRIp+XTeEXuGWgZX8Cyb XwzM73fPZjPnX1RXKPPA47IDbO1xICarrI2sh4iIorLXV6a+cX8dgg9KxkuvLP57m260 y+I9flPbMVzJhrPKaMh4TsPfo9bO9mk5hQfWX171j7WCjIbQ/Hq8EVlYlPckjNr1aBYm W4lYYjwSF4gTyK1ALcYQMMo/vfImEC0eH/pxzYAsv0ItXnH3Om14Kr+UcC7mQjJ8Rbya FKvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tKZio3A5XqTGjOSqkTiYmecRxV7CJahFURRExnU+n5g=; b=ZoYTPfvcsEQ6p5PNlc2lVoxJf1EGAHF+OHdsu9Q3K5msACXKROGE2H7OIAx6HTBAwd Xqx8+QTdE686Sp+dQD9OUS5Fs/zdRPoR4gh37EsoHqKIK9uaVqugy8tzZTzNJ+9AkUnF nWDF9LAWzQQqb4bd4cWlzfHhyEkyuiiidyDzQ2lzDlgYlH+YPhTrbvxLZ1NyRkQWm/PK cBR7Ut70M+d1e3eQU2Hr1vhN7qFJGaSWhMzgOlGkVTi0A/HDhPaDid+E4WQptdeLsAHy roEpN2LSggEw0HUucAFN68kGZiz48iOfPC/6GFa3AFst4yPGF82X0lmLfybii6gV2wDN mEtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nr2Yhtj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j20si17887593jak.112.2021.07.12.02.56.00; Mon, 12 Jul 2021 02:56:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nr2Yhtj9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240787AbhGLG46 (ORCPT + 99 others); Mon, 12 Jul 2021 02:56:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:34844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238139AbhGLGlB (ORCPT ); Mon, 12 Jul 2021 02:41:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 658D960238; Mon, 12 Jul 2021 06:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071892; bh=SPN59HIJNOyjHANCkHfWxpytUSmZiT81wmVpkJm97Ik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nr2Yhtj9MinroCbm1XIh/2s0S35TK9xqbfnGipDftGHQ9JfxVlg0dPCaiN3pPnldp YdWboUm2UELhRor8zQaOfzKYqjJImW+GduHVFk0dXbh+9vwUEuMC4njrrKBVCOyDIQ wDZjzYD2Jgekm8iNuGN/yzAaikAJoCQZqVQM927w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Donnefort , "Peter Zijlstra (Intel)" , Vincent Guittot , Sasha Levin Subject: [PATCH 5.10 265/593] sched/rt: Fix Deadline utilization tracking during policy change Date: Mon, 12 Jul 2021 08:07:05 +0200 Message-Id: <20210712060912.548240526@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vincent Donnefort [ Upstream commit d7d607096ae6d378b4e92d49946d22739c047d4c ] DL keeps track of the utilization on a per-rq basis with the structure avg_dl. This utilization is updated during task_tick_dl(), put_prev_task_dl() and set_next_task_dl(). However, when the current running task changes its policy, set_next_task_dl() which would usually take care of updating the utilization when the rq starts running DL tasks, will not see a such change, leaving the avg_dl structure outdated. When that very same task will be dequeued later, put_prev_task_dl() will then update the utilization, based on a wrong last_update_time, leading to a huge spike in the DL utilization signal. The signal would eventually recover from this issue after few ms. Even if no DL tasks are run, avg_dl is also updated in __update_blocked_others(). But as the CPU capacity depends partly on the avg_dl, this issue has nonetheless a significant impact on the scheduler. Fix this issue by ensuring a load update when a running task changes its policy to DL. Fixes: 3727e0e ("sched/dl: Add dl_rq utilization tracking") Signed-off-by: Vincent Donnefort Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Link: https://lore.kernel.org/r/1624271872-211872-3-git-send-email-vincent.donnefort@arm.com Signed-off-by: Sasha Levin --- kernel/sched/deadline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 8d06d1f4e2f7..6b98c1fe6e7f 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2470,6 +2470,8 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) check_preempt_curr_dl(rq, p, 0); else resched_curr(rq); + } else { + update_dl_rq_load_avg(rq_clock_pelt(rq), rq, 0); } } -- 2.30.2