Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp12047314ybi; Fri, 26 Jul 2019 03:58:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtoficuhHet0K6AQkFE6MhhTB3X3B3TVitCYAfbyrqbtLF8hntBYdTBhKnYrsR0gFfAt7T X-Received: by 2002:a17:90a:c391:: with SMTP id h17mr98302804pjt.131.1564138702709; Fri, 26 Jul 2019 03:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564138702; cv=none; d=google.com; s=arc-20160816; b=Evf8o2UKf037m/i37R1ub+V8iLeE6Iwv6Qi2uonilJFRXqtsH7USPw/+69XfXzeM+6 5FgFqe9P0tTSyxE2+wJKlTMZMxRpj0yrNF7YKRqpzqFRzRqSkPgE3H9s+iJdYPNbhkDK 8u3Y3Yl/MGNvcu0n0FIR5+R6cZak24w7rhlUTFA1gMHU8OYPK1pEIbrtE2U/1jevz8RL aIsYDDqN5golZwmtkT2r1XwINb0kqTrI2YUZryBts7panXQAPHGg3q7RJPWR1BzbFx6u c1TAuJtoi2QODXcAUQmbvhzpnKLTrbhyxTDUR4Arw/Ytw/AuJvYk49wRMCdZgSEEZY7a HOYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=ieMGO+dOrig1OK7z9buelcFdPzBQv4BTt8/qSYoEUHo=; b=uN65MKGJc2qHhKeULF7toXKhqrqMb735lhNgXhuWSWX8BYQugbdKZpMhSkbsWGbsOP goj0GPboqzFo33/Jm6RJDBfCCDnZsAWeUkb+kPT7vwEtE/DN83KlDP6vW3KJ2Aip9G7Q RMY+G57Lh/VSegnYe7yh3VktZas0nh5TYyXnRWTBbS6f9JOx/LyCxrs8ULtPYA6mvrzb ndnoa830/rkZugszE+tkfu+2vhVOj2w04siEqV8i8Mh3F3Fb7dUdutbkJ/uWjVQbVSQb I0DVqlCSHZXqhpMs2ZNbqyhxoMVATMteZJEizRzzc7w1R2s1UtkOUZiWDgDJWuWqRWon gMOw== 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 r33si24922459pgm.371.2019.07.26.03.58.07; Fri, 26 Jul 2019 03:58:22 -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 S1726193AbfGZKS1 (ORCPT + 99 others); Fri, 26 Jul 2019 06:18:27 -0400 Received: from mail.santannapisa.it ([193.205.80.98]:54369 "EHLO mail.santannapisa.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725815AbfGZKS0 (ORCPT ); Fri, 26 Jul 2019 06:18:26 -0400 Received: from [151.41.39.6] (account l.abeni@santannapisa.it HELO sweethome) by santannapisa.it (CommuniGate Pro SMTP 6.1.11) with ESMTPSA id 141117354; Fri, 26 Jul 2019 12:18:24 +0200 Date: Fri, 26 Jul 2019 12:18:19 +0200 From: luca abeni To: Dietmar Eggemann Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting Message-ID: <20190726121819.32be6fb1@sweethome> In-Reply-To: <20190726082756.5525-6-dietmar.eggemann@arm.com> References: <20190726082756.5525-1-dietmar.eggemann@arm.com> <20190726082756.5525-6-dietmar.eggemann@arm.com> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dietmar, On Fri, 26 Jul 2019 09:27:56 +0100 Dietmar Eggemann wrote: > 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. I think I tried this at some point, but if I remember well this solution does not work correctly when SCHED_DEBUG is not enabled. Luca > > 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); > }