Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11903763ybi; Fri, 26 Jul 2019 01:32:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpHzH4TX5fU77l1YgSUgZEdftI7dmAmo1ksPKoCa90IAQFbF4pVjGLk6R7/+GiNgyaexpl X-Received: by 2002:a62:18d4:: with SMTP id 203mr21261214pfy.165.1564129925395; Fri, 26 Jul 2019 01:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564129925; cv=none; d=google.com; s=arc-20160816; b=WPu//rY0a4sAPQ5HX+d8qFsu5lCpCbB1dTJe74MZPkaNaN2n4tzBkbYJ9gRdWJj2DE lKX3I7bFiYYTlNTs7m+UgUCu9rE/eyUhPgaV+Am80AL6B47ni1TjZlyQtO/qT9HcrK2J Wd8Eq9mO4dAm8/H6HFVmbiY5sf0utKT10JFpAFIBV+cIe3XdddoimLnWtchaGHCpXDf5 BARgc8DDfYccLSEQCO0aHCvz/gC1AiCG1JunoMCPVMKdsaMkLQNelJh5yA/dLQUtOhN8 ExSDog7AHHQrxngbPNZllsCFEa+FFAJRg3gufjbN/0iQw+3K66WzBBPn5hPlXNtPAzYj pxOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=JW50LD2LvSnN2UolzDfYTBO5C/XAbZ6LRM0eIo0Gtx4=; b=EJcu1Y+/Khh9IA/4Q2pYyKOUJQK7aDKEfdmghtcPkiFc9QVf0msDz4r6kAcVJdybMa OV4vMOBMtZgqt/lcbBXi8yq8ZupsyxeY2Lh95Y1rL0+0uvGeytzb979g409HHXxO0esK gNTmzFNbFGytsakNG8Sk9DEfornxKKees3iwimzNKv027pGUd0OwmYOX8tqNXIg+A64u 2aWFzam10YKaK8YBdTUYRt8TZDvpWAEszrkWthTnoIuSr9bVjwj8RcfuvcqnbgYiUyX4 cl+rkDPHjT1pjqTGUKFyMSgZ3oCxu94rbz/7DWbgvpqu2owbvV5rWu+pRUa434+yvpg5 3HXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29si16645874pgl.129.2019.07.26.01.31.49; Fri, 26 Jul 2019 01:32:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbfGZI3p (ORCPT + 99 others); Fri, 26 Jul 2019 04:29:45 -0400 Received: from foss.arm.com ([217.140.110.172]:39532 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726437AbfGZI3l (ORCPT ); Fri, 26 Jul 2019 04:29:41 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3294C152D; Fri, 26 Jul 2019 01:29:41 -0700 (PDT) Received: from e107985-lin.arm.com (e107985-lin.cambridge.arm.com [10.1.194.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0AD413F71A; Fri, 26 Jul 2019 01:29:39 -0700 (PDT) From: Dietmar Eggemann To: Peter Zijlstra , Ingo Molnar , Juri Lelli Cc: Luca Abeni , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting Date: Fri, 26 Jul 2019 09:27:56 +0100 Message-Id: <20190726082756.5525-6-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190726082756.5525-1-dietmar.eggemann@arm.com> References: <20190726082756.5525-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To make the decision whether to set rq or running bw to 0 in underflow case use the return value of SCHED_WARN_ON() rather than an extra if condition. Signed-off-by: Dietmar Eggemann --- kernel/sched/deadline.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index a9cb52ceb761..66c594b5507e 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -95,8 +95,7 @@ void __sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq) lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock); dl_rq->running_bw -= dl_bw; - SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */ - if (dl_rq->running_bw > old) + if (SCHED_WARN_ON(dl_rq->running_bw > old)) /* underflow */ dl_rq->running_bw = 0; /* kick cpufreq (see the comment in kernel/sched/sched.h). */ cpufreq_update_util(rq_of_dl_rq(dl_rq), 0); @@ -119,8 +118,7 @@ void __sub_rq_bw(u64 dl_bw, struct dl_rq *dl_rq) lockdep_assert_held(&(rq_of_dl_rq(dl_rq))->lock); dl_rq->this_bw -= dl_bw; - SCHED_WARN_ON(dl_rq->this_bw > old); /* underflow */ - if (dl_rq->this_bw > old) + if (SCHED_WARN_ON(dl_rq->this_bw > old)) /* underflow */ dl_rq->this_bw = 0; SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw); } -- 2.17.1