Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4508572ybi; Tue, 30 Jul 2019 03:19:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqQxTELmmjZexLIVB3UYPpMNzayV7xvRlZ2QMPhPSCsfSAZaE8KlsALacUH/MNPqYwO8Gu X-Received: by 2002:a17:90b:d8b:: with SMTP id bg11mr116539473pjb.30.1564481957784; Tue, 30 Jul 2019 03:19:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564481957; cv=none; d=google.com; s=arc-20160816; b=MPEfv8qtsH0G6nsswGOjOAw31GDQxZAWC8033x4gj0JioHNv0NGWEMuw4EQaCrZQxz e0y4USo3N5c/rP6DcWxRVHi5pKNTofryd4dRkQ3GhDK0PubJWZL2xw9xopdDaEGa+p9N Des1ZCpXuLv9lAfQ/e3E/Y9ZQ0xhVXxpYpbv4lI6F7cLRq8Zm62n9jRg+pvwoelx3bbr ck1BlPH3jJO6RFvX67kjGYa3EIY+Q0aYzbyo/yXA4rgfgZ9e6y0gShMqFHEz4761fKCu UEePXsWdjzwGhzeD3e+2TksspoW1NXXhyXgMhxw04hNFZTXyaWZuRxApOPmCOnk0IBul pNaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7vdnLGgCJYtbW7FK96EXzyS9jXfM/zfzKmdlAEa+8Qs=; b=nuCLEu4ZN15zss6NJPgcILamfG6ll3dHjkuuMwGf5wvQx4dsr/5S5Wq62yTub5rSST 2CmoYyPWcKHXG1ma/sSpcLiqVLQ0/yGlzHOb+NhbVdCom2HyuMHbZxGEYZR8c3GH11Pn xS19j6NwU0wQCQ+dv9yRZrllO15p5fmbi4PkiLdbjbnO6HODAVmKHc+IDtPok78pVDBr bRxDgxhzG1hppYKyxPFo21Bqog3Arz3eDRsQFLVQdugNKYgOlja9biEa45tt//zmWdLx inKYidhhTlYId1OkVSbgKD++J1wLhafF9s1Jf5JWKbiFW2MehlyLF52Dvu+dYm4ZiCuh LRmA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si11088847pfd.29.2019.07.30.03.18.53; Tue, 30 Jul 2019 03:19:17 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728981AbfG3GlV (ORCPT + 99 others); Tue, 30 Jul 2019 02:41:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42605 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726736AbfG3GlU (ORCPT ); Tue, 30 Jul 2019 02:41:20 -0400 Received: by mail-wr1-f67.google.com with SMTP id x1so14496697wrr.9 for ; Mon, 29 Jul 2019 23:41:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7vdnLGgCJYtbW7FK96EXzyS9jXfM/zfzKmdlAEa+8Qs=; b=SkWjIdd9t2CUJNMsihvHjrfmaDGF7hhtjBVV1lAADxucSco1/8Q46rtb21hs+bEdor wJaSqlZwzOOy0GTlSDlvJOMvovA0tzZYNZiT/EH7XCNu82NUqcX5ABGVFcx+C8Ij7vC1 BAJoHpRL8BgnErcZYJwYEdG5OILbQDtVia/E/bI5BLE6ERKQYTSyd6LQWQxZA92rFdJl 4y6XVyzFAkW9J87l0A8Bqut5tLVViIw9Z55ZSWggwyOBa1JBWkDjVIvQjvvWtUswLnCU SoJGQsH0uoGDyM7UsEyBIxzL1hpruaVyADtkxXmEH7nrKKnd/2L4W6aVj4PxMexdggJL +U1Q== X-Gm-Message-State: APjAAAULtlhdIdumjtRFucCYpnf5rhVsvqDPVuNJeE+DOKxwVbm9hatp DSr3ZCAGt31aF/PgNEFILqx1wQ== X-Received: by 2002:a5d:46cf:: with SMTP id g15mr129745861wrs.93.1564468878561; Mon, 29 Jul 2019 23:41:18 -0700 (PDT) Received: from localhost.localdomain ([151.29.237.107]) by smtp.gmail.com with ESMTPSA id i66sm105876293wmi.11.2019.07.29.23.41.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jul 2019 23:41:17 -0700 (PDT) Date: Tue, 30 Jul 2019 08:41:15 +0200 From: Juri Lelli To: Peter Zijlstra Cc: Dietmar Eggemann , Ingo Molnar , Luca Abeni , Daniel Bristot de Oliveira , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] sched/deadline: Cleanup on_dl_rq() handling Message-ID: <20190730064115.GC8927@localhost.localdomain> References: <20190726082756.5525-1-dietmar.eggemann@arm.com> <20190726082756.5525-5-dietmar.eggemann@arm.com> <20190729164932.GN31398@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729164932.GN31398@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/07/19 18:49, Peter Zijlstra wrote: > On Fri, Jul 26, 2019 at 09:27:55AM +0100, Dietmar Eggemann wrote: > > Remove BUG_ON() in __enqueue_dl_entity() since there is already one in > > enqueue_dl_entity(). > > > > Move the check that the dl_se is not on the dl_rq from > > __dequeue_dl_entity() to dequeue_dl_entity() to align with the enqueue > > side and use the on_dl_rq() helper function. > > > > Signed-off-by: Dietmar Eggemann > > --- > > kernel/sched/deadline.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > > index 1fa005f79307..a9cb52ceb761 100644 > > --- a/kernel/sched/deadline.c > > +++ b/kernel/sched/deadline.c > > @@ -1407,8 +1407,6 @@ static void __enqueue_dl_entity(struct sched_dl_entity *dl_se) > > struct sched_dl_entity *entry; > > int leftmost = 1; > > > > - BUG_ON(!RB_EMPTY_NODE(&dl_se->rb_node)); > > - > > while (*link) { > > parent = *link; > > entry = rb_entry(parent, struct sched_dl_entity, rb_node); > > @@ -1430,9 +1428,6 @@ static void __dequeue_dl_entity(struct sched_dl_entity *dl_se) > > { > > struct dl_rq *dl_rq = dl_rq_of_se(dl_se); > > > > - if (RB_EMPTY_NODE(&dl_se->rb_node)) > > - return; > > - > > rb_erase_cached(&dl_se->rb_node, &dl_rq->root); > > RB_CLEAR_NODE(&dl_se->rb_node); > > > > @@ -1466,6 +1461,9 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se, > > > > static void dequeue_dl_entity(struct sched_dl_entity *dl_se) > > { > > + if (!on_dl_rq(dl_se)) > > + return; > > Why allow double dequeue instead of WARN? As I was saying to Valentin, it can currently happen that a task could have already been dequeued by update_curr_dl()->throttle called by dequeue_task_dl() before calling __dequeue_task_dl(). Do you think we should check for this condition before calling into dequeue_dl_entity()?