From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92EF036EAB3 for ; Wed, 4 Mar 2026 13:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772632768; cv=none; b=o128dNByuN2jKCk3XfOAa55kpPRfQPOP2WEY5nnfNnBMU+8VVOcUsrYf0zfJ+OQ2oCacbOuLk+o7GIJEOWRtILShcXgNysrioXxjo5DBnHYt9dyycSZfBT42YmZAMA2CtnO7sjXNOkqh+osiNGr2KzPzdaPavhO4ZPtGrGlRrZU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772632768; c=relaxed/simple; bh=77x2Y++771l1wJa4LtLzdn1ETUZxYJF720dVcTPJX5U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rZGU/gXvRJ6o70lVhKDA8bI8yx3hIcUd7BHDje1QRHfPle93PiiktB7MiahMYl2Lt5bUF7ZW1OQzQB7WgX/CQM82SKJR3hOZA2OQBnSP/fz+mJVz5iKKA4aZOTQ3KEW2/NXEOdVWjGotmXqDchLKCUptLulYvyT2uqnXCuIlC+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Uohn6qfW; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=XXYQDud0; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Uohn6qfW"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="XXYQDud0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772632766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7Fvy/d4GSwKd0KgLzzcqJmfbIzelAmbPuLsa7ja6FVc=; b=Uohn6qfW0oa9wcChzLOvQNAe2Yy7tUnQONgoQuMJoSNjcw2qDVo9/qmt+A1ofrDuveU68+ aclMzSh+wEPzqGWy0pK4iCFNnQNsYxUu5VrJI1TzlCstG6FW9B7EzQnG9gCfkoKAzUDAZO DiO9Uz+Zq4S+b+JMRd6x/4RdJnw/Ayo= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-90-PiewlFk4MJe0ZpRBhOiOfA-1; Wed, 04 Mar 2026 08:59:25 -0500 X-MC-Unique: PiewlFk4MJe0ZpRBhOiOfA-1 X-Mimecast-MFC-AGG-ID: PiewlFk4MJe0ZpRBhOiOfA_1772632763 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4832c4621c2so74538085e9.3 for ; Wed, 04 Mar 2026 05:59:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1772632763; x=1773237563; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=7Fvy/d4GSwKd0KgLzzcqJmfbIzelAmbPuLsa7ja6FVc=; b=XXYQDud0CNxqUOaC/BpQRZ4IQDqN/keOVKqco3D/9JUNCU3lrmLBGUTxc4tKCWZbYf xb91F97/S+J1E+ssPqXiXLXr5iwDAfoiOiXNnIwiRv1wEvcD8vHoto9gExFw4kwJtJMY GLOrjOcQqqqScWDgk14eqjEWAKxGt88g8WeidYBO65mY6ArMMmc9XbSGyXv7uz+QWS0z aavjtGpsjU2lvr6Rj171rk69O6zPSoQfV+ETkieFWevSrW/GcZ14mMD9IEf7eyiA72BA rcwaIw3GKTBiW6FOIMHL3DIKs58G3nBpiTuIxBjcn8RlwUEPEIweAG95ZeZ5ehGBgaqp Jp6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772632763; x=1773237563; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7Fvy/d4GSwKd0KgLzzcqJmfbIzelAmbPuLsa7ja6FVc=; b=o919dZthoJffQSHFiesnTfVzMLWcAOUBc2LgU6AGIaKaNbZKbYK0U9+mOBkAX8JXGS rAGlD7k77LP6WzWLj1flO/GBAaV0da/OhHHPYNLr+Q37FnobT6+z3z/bsMZ3j87hbNNx Lmh57L2+kg4+M0UmRu5ubT4oZ9u0wG/hW3O0jj8bcWdyFusGvdzMoehbAsgKWqeiUNui r1kaGF23rn+0s9AU/gLuALMWadPWPCgLrN8AZoLou9TgUNTBEx2vr1lSi2XFAFkuRhKS qe/t3072wF/FQzxeLN23R3nFNOThVWngvlbBb8VyvCDM7lkfU9cDA4zY58Mc5ckOdQGh gPaQ== X-Forwarded-Encrypted: i=1; AJvYcCW+wXJrAa0YC1Ph5ENFGR0Tn6DLfSVYVL8W8//XBwYI6o8HKUDNWAUHSU+cgAT9M5e1dqmHwmBead5souI=@vger.kernel.org X-Gm-Message-State: AOJu0Ywwarn3XAwbf7NNViQlnGVxC56XKjN9ydTmvSYpDqsWhaDjmLtV I+x7R55lGCA77Q/NF25+GY5lte6zZhQd7C4dXrJ1ucqnfec2mnsFyq/HQ8dQ240OHMwSKxZ44Yw vqVT3id8+nbPDnkxJOiV24ZF4w+GAs+bPpyiM9ySn1CNgI/or0rz/tTvo1zGoyc5+iQ== X-Gm-Gg: ATEYQzwsCTI8520Nj1AFY/WudNzMHm9ZQblpk+AtDPIOUvTP405+RkWzN4OEyC7dmnn WjPocGe7rPYoQyGR8zJKFh+M/fzgnO/tuJuaH3rfAcKT4hrHLS3oAA82ggwJmiDAvlDWIrhCJcK 0Xznp6xuiAzo/+WnaZEfuw/PUWwKDFOoga4kpTBv06BmtpWmZP+aPEfNIE5eUixfvlVOeLSGThA KGQV060uvEYcMsMfEbE1hfrXgtzFDjfkguatHMMMsuEJc+/mimKt4cgdouKn3zFwxLdsvkg0d4J jXhfPsCx2xvu+qtLhw13gTJj8l9rsk9YyTGkLgN9KdEnjFJTFKWyeZYKZP/ubxXu5jB9LLu+LzH rWEEPqaOG3/VIvQn+nKfJbXXvVFPQm3ASnglMaOCSEA2U/ArN4vY= X-Received: by 2002:a05:600c:4e03:b0:480:4b59:932e with SMTP id 5b1f17b1804b1-48519841617mr37693115e9.11.1772632763272; Wed, 04 Mar 2026 05:59:23 -0800 (PST) X-Received: by 2002:a05:600c:4e03:b0:480:4b59:932e with SMTP id 5b1f17b1804b1-48519841617mr37692755e9.11.1772632762760; Wed, 04 Mar 2026 05:59:22 -0800 (PST) Received: from jlelli-thinkpadt14gen4.remote.csb ([151.29.73.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-485187bf2fcsm55899845e9.4.2026.03.04.05.59.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 05:59:21 -0800 (PST) Date: Wed, 4 Mar 2026 14:59:19 +0100 From: Juri Lelli To: Peter Zijlstra Cc: John Stultz , LKML , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , Suleiman Souhlal , K Prateek Nayak , kernel-team@android.com Subject: Re: [PATCH] [RFC]: sched/deadline: Avoid double enqueue_pushable_dl_task() warning Message-ID: References: <20260303194120.4102982-1-jstultz@google.com> <20260304095123.GP606826@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260304095123.GP606826@noisy.programming.kicks-ass.net> On 04/03/26 10:51, Peter Zijlstra wrote: > On Wed, Mar 04, 2026 at 08:06:53AM +0100, Juri Lelli wrote: > > Hello, > > > > On 03/03/26 19:41, John Stultz wrote: > > > In testing with the full Proxy Execution patch stack, I found > > > I would occasionally trip over the !RB_EMPTY_NODE() WARN_ON in > > > enqueue_pushable_dl_task(), where the task we're adding to the > > > pushable list is already enqueued. > > > > > > This triggers from put_prev_task_dl(), where it seems we go into > > > put_prev_task_dl() > > > -> update_curr_dl() > > > -> update_curr_dl_se() [hitting the dl_runtime_exceeded() case] > > > -> enqueue_task_dl() > > > -> enqueue_pushable_dl_task() > > > > > > Adding the task to the pushable the first time. > > > > Ah, so in case the task is boosted (or we fail to start the > > replenishment timer). > > > > > Then we back up the call stack to put_prev_task_dl(), which at > > > the end again calls enqueue_pushable_dl_task(), trying to add it > > > a second time, tripping the warning. > > > > > > To avoid this, add a dl_task_pushable() helper which we can use > > > to replace the RB_EMPTY_NODE checks elsewhere, and then before > > > enqueueing in put_prev_task_dl(), we can first check > > > dl_task_pushable() to avoid the double enqueue. > > > > Can't we just return early (as we do already in dequeue_pushable > > _dl_task()) in enqueue_pushable_dl_task() instead of checking before > > calling that function? > > So I was mightily confused for a moment by all this. > > But it turns out DL keeps current *in* the tree; since ->deadline is a > lot less mutable than ->vruntime this is possible. > > But that also means that set_next_task() / put_prev_task() are > 'simpler'. > > However, in this case I think they are too simple, and its leading to > problems. > > So update_curr_dl() needs to dequeue+enqueue because it is pushing > ->deadline (because current is in tree). Then because of that, it also > ends up doing enqueue_pushable, but that is actively wrong, you must not > do that on current. > > Only once you're doing put_prev_task() must you do that. > > Imagine this happens because of an update_curr() that is not from > put_prev_task(), then you end up with current on the pushable list, > which is a big no-no. > > So I think I'd like to see dl_rq->curr tracking, similar to what we have > for fair. > > If you do that (see below), you'll probably find this case was already > handled 'correctly' but was broken by the PE thing ;-) > > Note the !task_current() clause in enqueue_task_dl() guarding > enqueue_pushable_dl_task(). Ah, indeed. The below makes sense to me. Let's see if John's tests are happy as well. Thanks, Juri