Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3601038pxv; Mon, 5 Jul 2021 00:58:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa46GVj85QTuqaLBRRFiY9e0p7tQ8DlI1LSj+vXiHQvKBDCTHUaDAPkLCLRTEg08mJXwNL X-Received: by 2002:a05:6402:34c1:: with SMTP id w1mr14988442edc.104.1625471888232; Mon, 05 Jul 2021 00:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625471888; cv=none; d=google.com; s=arc-20160816; b=HjvCaD9uVfI4h9MYr2qTTtA8bjUJZOruyndkBxLr5QmN8KMIJ+cW2Qaa2+2Rp8ager 7LmEscy6gxkC1uHQDjFiBH4BmSz/jzkgvg5QiUKUUnU5joyP0SItEusziK6VbjRqooEV oSjCbEAIqGSyASA6XEaK0M/r9kcSDfE5ieneVH0aIGcK1Aga6gSnKk66aQqTEIYnmtmf 0NMptx3EmxTmwEGhkQpEzDQCChznPlckbDu3+NQHRzbhIPylp0heJp4heU/mKboPqowl BLGT/rkwXwtElATAc7gR1vJxDzohtvGjxYKcDLvo2xVwAd2CP6Yxvst+VRZXCrEoiOpt eTrg== 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=wadRKsbsMPIWc59pF+sqvsbDZoGN+1JgIDBKdNQCkVI=; b=0d5i7MykE+Gl8gHu6tTpI10FlmnpxfUjn3PWdc6rfgjFAmBkKLwwu4oxNQPoQdpnlK xnmY3H4jKJQTHAnklz1guGqsF4tXSCBDTYsShqP6x64fnlLm97tjreh/yILFOj8Dmxa9 OM1F2QSn2sQyhUPVX5Rt3Q+B1v/UYu8Vlb9A7xdgakZW9l61/qNH2pL/fMoFXo7QeVXe YSCxu5X23BFAOt18TpANyKq3yYVTxym0IEZEmCFRvHaG1PEgaW6zgqeLw7WudZsuk1Sn p+yuok22Hv7UbxuMs4rm7Wi+DHjlPxQwQjnr6I/0n7WrzmoRsc98R8+lx6u1Ub0cgbis oo1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EP5UDEkt; dkim=neutral (no key) header.i=@linutronix.de header.b=8rj6ytXp; 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 du5si8805370ejc.255.2021.07.05.00.57.44; Mon, 05 Jul 2021 00:58:08 -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=EP5UDEkt; dkim=neutral (no key) header.i=@linutronix.de header.b=8rj6ytXp; 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 S230146AbhGEH4w (ORCPT + 99 others); Mon, 5 Jul 2021 03:56:52 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:59258 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230264AbhGEH4g (ORCPT ); Mon, 5 Jul 2021 03:56:36 -0400 Date: Mon, 05 Jul 2021 07:53:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1625471638; 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=wadRKsbsMPIWc59pF+sqvsbDZoGN+1JgIDBKdNQCkVI=; b=EP5UDEktB9f2ObixeQdp7LYhY0g51n3W9+gk8hz7Nm9KnAwZLmbNNYVtowIhY0xB6GZte8 eppM7xugW5uzJVWv1WQnhlvKjUp4B4NKCEopwWLWYhWoPXXIiBgj33NeguA5ZVys1qHrfY SMnFtpd1ZbJpKgIE7rwKFlgruUM1HnAHi7qDTlDqAWi3lqmlyxi8Bo8vwrpV2L/rf0gmjl zGFWttbCMZUIc/HvzjNGSrWemI7z8We+iZbulSkvVYOuSm1d1KYBeYW2mJcqUhmottIysq 0GijjCFiCYQBbUAd9nuquqI8dc7KtNdfUDexBhaizzDLy3O1VVq7CEzxUdWQOg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1625471638; 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=wadRKsbsMPIWc59pF+sqvsbDZoGN+1JgIDBKdNQCkVI=; b=8rj6ytXpqver4WvPSxXJmOjwjJQQvgUz4zueQ0FGrms/eiSaPY0FoK6ux4SGBl/8iE3L7m xLYRMcifi28tfdAw== From: "tip-bot2 for Odin Ugedal" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/fair: Fix CFS bandwidth hrtimer expiry type Cc: Odin Ugedal , "Peter Zijlstra (Intel)" , Ben Segall , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210629121452.18429-1-odin@uged.al> References: <20210629121452.18429-1-odin@uged.al> MIME-Version: 1.0 Message-ID: <162547163801.395.3977019363833751380.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/urgent branch of tip: Commit-ID: 72d0ad7cb5bad265adb2014dbe46c4ccb11afaba Gitweb: https://git.kernel.org/tip/72d0ad7cb5bad265adb2014dbe46c4ccb11afaba Author: Odin Ugedal AuthorDate: Tue, 29 Jun 2021 14:14:52 +02:00 Committer: Peter Zijlstra CommitterDate: Fri, 02 Jul 2021 15:58:24 +02:00 sched/fair: Fix CFS bandwidth hrtimer expiry type The time remaining until expiry of the refresh_timer can be negative. Casting the type to an unsigned 64-bit value will cause integer underflow, making the runtime_refresh_within return false instead of true. These situations are rare, but they do happen. This does not cause user-facing issues or errors; other than possibly unthrottling cfs_rq's using runtime from the previous period(s), making the CFS bandwidth enforcement less strict in those (special) situations. Signed-off-by: Odin Ugedal Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Ben Segall Link: https://lore.kernel.org/r/20210629121452.18429-1-odin@uged.al --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1e263c9..1b15a19 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5054,7 +5054,7 @@ static const u64 cfs_bandwidth_slack_period = 5 * NSEC_PER_MSEC; static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire) { struct hrtimer *refresh_timer = &cfs_b->period_timer; - u64 remaining; + s64 remaining; /* if the call-back is running a quota refresh is already occurring */ if (hrtimer_callback_running(refresh_timer)) @@ -5062,7 +5062,7 @@ static int runtime_refresh_within(struct cfs_bandwidth *cfs_b, u64 min_expire) /* is a quota refresh about to occur? */ remaining = ktime_to_ns(hrtimer_expires_remaining(refresh_timer)); - if (remaining < min_expire) + if (remaining < (s64)min_expire) return 1; return 0;