Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752850AbcLEWaq (ORCPT ); Mon, 5 Dec 2016 17:30:46 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35916 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751618AbcLEWak (ORCPT ); Mon, 5 Dec 2016 17:30:40 -0500 Date: Mon, 5 Dec 2016 23:30:05 +0100 From: luca abeni To: Peter Zijlstra Cc: Steven Rostedt , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org, Ingo Molnar , Juri Lelli , Claudio Scordino Subject: Re: [RFC v3 1/6] Track the active utilisation Message-ID: <20161205233005.54275bd6@sweethome> In-Reply-To: <20161118142359.GK3142@twins.programming.kicks-ass.net> References: <1477317998-7487-1-git-send-email-luca.abeni@unitn.it> <1477317998-7487-2-git-send-email-luca.abeni@unitn.it> <20161025112916.67eb245c@utopia> <20161025095811.50a5856a@gandalf.local.home> <20161118142359.GK3142@twins.programming.kicks-ass.net> Organization: university of trento X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; 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 List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1240 Lines: 42 Hi Peter, On Fri, 18 Nov 2016 15:23:59 +0100 Peter Zijlstra wrote: [...] > u64 running_bw; > > static void add_running_bw(struct sched_dl_entity *dl_se, struct > dl_rq *dl_rq) { > u64 old = dl_rq->running_bw; > > dl_rq->running_bw += dl_se->dl_bw; > SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */ > } > > static void sub_running_bw(struct sched_dl_entity *dl_se, struct > dl_rq *dl_rq) { > u64 old = dl_rq->running_bw; > > dl_rq->running_bw -= dl_se->dl_bw; > SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */ > } I wanted to change "SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */" into "if (SCHED_WARN_ON(...)) dl_rq->running_bw = 0" (to avoid using nonsensical "running_bw" values), but I see that "SCHED_WARN_ON()" cannot be used inside an if (this seems to be a difference respect to "SCHED_WARN()"). This is because of the definition used when CONFIG_SCHED_DEBUG is not defined (I noticed the issue when testing with random kernel configurations). Is this expected? If yes, what should I do in this case? Something like SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */ if (dl_rq->running_bw > old) dl_rq->running_bw = 0; ? Or something else? Thanks, Luca