Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3602695pxk; Tue, 29 Sep 2020 00:58:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4cMIF1wgGpXX7bBIku0B7V0DSdwYIGxVwf2AQBDdves5DaRRkL82hFFyHvNoqskis0OQo X-Received: by 2002:a17:906:30c7:: with SMTP id b7mr2712599ejb.7.1601366321489; Tue, 29 Sep 2020 00:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601366321; cv=none; d=google.com; s=arc-20160816; b=1IEqGaagJuXR2qcF5gRQ7dJBsqnNmhlvZ5vgAo21MrY4CEt6Kkxs8byetnOHgqQIcu sX8HvlE4NpGBetDjGEGT2DYXiOF40v6fmb1SoAEKqh3up7dpmPDVnxi+yhp6oYdKzx5J oaUqa6UtaLFL3H1LlwzpbXfv1iUhwqHfTZfnLzofxB7wDSa2GwDBomxhyiNNXlIc+9AO KgB4WqcrFjNYgTklxAg7v2IvMW6oLiOsmMqvboOJ6MOWWO/DHguGBUJ5Tm9H5uu64pFA La9q2+jfQkBA7ks95oojBqpc6YRFxzYOHlL+ESk7n0VFFgxgy8rvlxPw8LDgQdJHOWWF j74A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=sSr+Me/c5x9os+xUvFwv4kI6DU7PHuIuud7+xmT9O00=; b=eDU8Os+DbE4265mf5A2lp/Sf8AvgbrlnncNBCxTNvQGRCoHv9p2+ZDXPJUXWso/diH okTCmPUcyFuameI3US5R2TUkW2V2ZZ3VNKY81hu/CVEVbPf/OUZHbuCcYOCdyPBgnKmK M5uUq50KvVrCW7Bji0XbkoexIyUXqVIlEGNaBBJTasK2kmvHDNcpt3k8kWn1w7a8lohc 1TX/7axZPPn08ztpwiUZF2i8Zdg1czdgOWxZrRFBkmGogvQlmrRvqZAJNYpBaGqdh2fF cv61vkenrvQp68cXgItmagiR1M1dpyNUw7VrUWqwNwV/F5Mdab+dXdRjj7vTqBkV1maO lU1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="YturEfF/"; dkim=neutral (no key) header.i=@linutronix.de header.b=ucpLxgAQ; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a13si2106366ejf.427.2020.09.29.00.58.18; Tue, 29 Sep 2020 00:58:41 -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=@linutronix.de header.s=2020 header.b="YturEfF/"; dkim=neutral (no key) header.i=@linutronix.de header.b=ucpLxgAQ; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727737AbgI2H5K (ORCPT + 99 others); Tue, 29 Sep 2020 03:57:10 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44408 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727681AbgI2H4z (ORCPT ); Tue, 29 Sep 2020 03:56:55 -0400 Date: Tue, 29 Sep 2020 07:56:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1601366213; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sSr+Me/c5x9os+xUvFwv4kI6DU7PHuIuud7+xmT9O00=; b=YturEfF/wOTfOtT3Bdl3RPgEnOXw0AzDZN6Hi329H6RI2p5frR2Z4nDo/PJsRvgeWQfFKr y6dHyhXYFlQd3Wc0rzhhR9CI6Po3x/MrmOoy6t1ZZh+qC+UagYqMk+l2QqOV+EzFdgRuQj 8oXH8bp6nNypHHFOzZJUnHtsB493If7wwLn+Evds6Xbl15O4DLI9AZqLDMdIlQGijzod9z YPw5VMbK4YxbUQxiH47VEvrhZ8LuZ0bw9w9mtvzwHDBPl+ILd3nVOVx+PbeFMP66t+xdfP ErTvYOM1nGVzujxMFmfVshvwdxdTwgvFEOk9wup7Re3grdGAJNE5a2U8/kcTJQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1601366213; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sSr+Me/c5x9os+xUvFwv4kI6DU7PHuIuud7+xmT9O00=; b=ucpLxgAQYdgKLGX2aTh3pFbbinJ08CRYEaUX03bH+8e5d7rjr3ggqJ5mJbq+btvpLTPUrY XIeap8lv0B//LVDg== From: "tip-bot2 for Lucas Stach" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/deadline: Fix stale throttling on de-/boosted tasks Cc: Lucas Stach , "Peter Zijlstra (Intel)" , Juri Lelli , x86 , LKML In-Reply-To: <20200831110719.2126930-1-l.stach@pengutronix.de> References: <20200831110719.2126930-1-l.stach@pengutronix.de> MIME-Version: 1.0 Message-ID: <160136621248.7002.15248843800877733816.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 46fcc4b00c3cca8adb9b7c9afdd499f64e427135 Gitweb: https://git.kernel.org/tip/46fcc4b00c3cca8adb9b7c9afdd499f64e427135 Author: Lucas Stach AuthorDate: Mon, 31 Aug 2020 13:07:19 +02:00 Committer: Peter Zijlstra CommitterDate: Fri, 25 Sep 2020 14:23:24 +02:00 sched/deadline: Fix stale throttling on de-/boosted tasks When a boosted task gets throttled, what normally happens is that it's immediately enqueued again with ENQUEUE_REPLENISH, which replenishes the runtime and clears the dl_throttled flag. There is a special case however: if the throttling happened on sched-out and the task has been deboosted in the meantime, the replenish is skipped as the task will return to its normal scheduling class. This leaves the task with the dl_throttled flag set. Now if the task gets boosted up to the deadline scheduling class again while it is sleeping, it's still in the throttled state. The normal wakeup however will enqueue the task with ENQUEUE_REPLENISH not set, so we don't actually place it on the rq. Thus we end up with a task that is runnable, but not actually on the rq and neither a immediate replenishment happens, nor is the replenishment timer set up, so the task is stuck in forever-throttled limbo. Clear the dl_throttled flag before dropping back to the normal scheduling class to fix this issue. Signed-off-by: Lucas Stach Signed-off-by: Peter Zijlstra (Intel) Acked-by: Juri Lelli Link: https://lkml.kernel.org/r/20200831110719.2126930-1-l.stach@pengutronix.de --- kernel/sched/deadline.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 3862a28..c19c188 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1527,12 +1527,15 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) pi_se = &pi_task->dl; } else if (!dl_prio(p->normal_prio)) { /* - * Special case in which we have a !SCHED_DEADLINE task - * that is going to be deboosted, but exceeds its - * runtime while doing so. No point in replenishing - * it, as it's going to return back to its original - * scheduling class after this. + * Special case in which we have a !SCHED_DEADLINE task that is going + * to be deboosted, but exceeds its runtime while doing so. No point in + * replenishing it, as it's going to return back to its original + * scheduling class after this. If it has been throttled, we need to + * clear the flag, otherwise the task may wake up as throttled after + * being boosted again with no means to replenish the runtime and clear + * the throttle. */ + p->dl.dl_throttled = 0; BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH); return; }