From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 1FA2654768 for ; Wed, 22 Apr 2026 14:28:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776868119; cv=none; b=o1p+jKJJCbZ+nJFfrruaUxUfiVb68U/ObwxvI2o3M2GTEWwlAU+ICpudAJl5rSldekWRiQBtf75HVR+sslTdsA3o39ZK0OKFnK+cO2gCuZ8Nd+YIPSmuiP/MO15Jv5MZNDhmz986nPuv/ZKtsMwYYo+uDqp6vtMVVPtCaOhxs6M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776868119; c=relaxed/simple; bh=SHFPa1oHhvrsbSmAryZjpkcVFjlOHo7yN+s9gL3W1Kk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kWQE9A1XRZh5l7h713OR3ljgZBLmBqCz54rlzQuSNMTdAk6Rn6SUoxtxnjalT9ArMTOXTobJ0S36nunrptb78HIN1QdX9a4+XJonLvFows8M8/v/chNQw5KBkaAkxaf1XmcUX+AI31rZUxjlSIyUGo3fwpTVNBzk/SRr3kaQnUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=e4xX7BcO; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="e4xX7BcO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=f/q5Mu8vmP8kvK1aDfs5yP2ezA5EmJ5kF1pt9GWHPXE=; b=e4xX7BcO/9ctZlKdx++u3AuGDI pTYye2FndkZniChLb+/uab1sAV9Wn55ZkU9elPi3bkoGEojVB+7TG4yB35fhxe9w1wwnI8VawVXjo fscPpkd/pXH7Y/IyBoovQZ1cyFNdRKaj+R5lJFxZUk94C4UHuY0NHvBLH+jbTtBz6CTzjMbgLziPR 9b/DqZihEWAOshdch/hQTnQ5bc7f09nMgHo3EihdLHzTmKTzrDIvveCrcmFZiYV7IFNeDfhN/bNub 9Mik9dSPhPld1e7mpy/ZKyFKU7pNnhN4ebqkKT/Ky+IoUQo3iI1uoXRFRt+6ZEfn7CWHKbIc49+nA nllQXDXw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wFYZ3-0000000BsQh-2VRS; Wed, 22 Apr 2026 14:28:29 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 4DECB300BD2; Wed, 22 Apr 2026 16:28:28 +0200 (CEST) Date: Wed, 22 Apr 2026 16:28:28 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, shubhang@os.amperecomputing.com Subject: Re: [PATCH v2] sched: fair: Prevent negative lag increase during delayed dequeue Message-ID: <20260422142828.GJ3102924@noisy.programming.kicks-ass.net> References: <20260331162352.551501-1-vincent.guittot@linaro.org> <20260402131359.GZ2872@noisy.programming.kicks-ass.net> <20260422133914.GP3102624@noisy.programming.kicks-ass.net> <20260422142410.GS3102624@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: <20260422142410.GS3102624@noisy.programming.kicks-ass.net> On Wed, Apr 22, 2026 at 04:24:11PM +0200, Peter Zijlstra wrote: > On Wed, Apr 22, 2026 at 04:06:42PM +0200, Vincent Guittot wrote: > > On Wed, 22 Apr 2026 at 15:39, Peter Zijlstra wrote: > > > > That said, on IRQ you mentioned that this wasn't quite good enough and > > > that your original patch is best. > > > > Yes, it fixes one case but breaks the other one :-( > > > > > > > > The trouble is, your original patch can update vlag (!se->sched_delayed) > > > and report it hasn't changed; because then vlag == se->clag, obviously. > > > > In the (!se->sched_delayed), we don't care because the entity is not > > enqueued so we don't need to place it with new vlag > > I am confused more :-) this could be dequeue_entity() doing a normal > dequeue, in which case it very much is enqueued. We only delay for > !eligible, !special etc.. > > > > This invalidates the comment on the return value of the function. In > > > fact, it makes the function have a very non-obvious return meaning. > > > > > > So I'm a little confused -- what do we actually want this function to > > > do? > > > > I want update_entity_lag() to return true if we have modified the vlag > > of an enqueued entity. In this case we need to dequeue, place entity > > with new vlag and enqueue it. > > > > we don't need to test se->on_rq because update_entity_lag() is called > > for enqueued task only with delayed dequeue entity so > > se->sched_delayed implies se->on_rq > > > > In fact we should test : > > (vlag != se->vlag) && se->on_rq > > but && se->on_rq is useless > > > > That being said, this probably deserves a comment > > But but, dequeue_entity()'s second update_entity_lag() call can have: > > se->sched_delayed == 0 && se->on_rq == 1 > > Think dequeue of eligible or special or... So only requeue_delayed_entity() cares about the return value, and there it holds what you say, but that is a very narrow case and doesn't reflect all the callsites. Let me ponder this a bit...