From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 D5CB72147E5 for ; Wed, 22 Apr 2026 14:24:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776867860; cv=none; b=tft1mxv+U+5OXmlNEfseKOS3bZ94GXqha1K70Da8X/RDSz2RBj8TV/DSoUiqUqnZFnBNg/8mFD79SYegCNSUL22MGL2xyivWyOF9x/2dzoCVTkElDkDOjoVTSEYuGqsfyiMIDTAf+sfUbDjTxf+9dXulpBgo8OAGanw12LMT5ks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776867860; c=relaxed/simple; bh=i6tQNTcbzReTE3Bw719kQoyGbU8L4BFnNMLzhUYpGKI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UdUwOldSvgboOAl4CI7LDLtarbrGXLNbbcrMMYu1htCKlZYE5FVAUJ6b3w9O9nfLtn+QWVM5eVwp7gU4Zy5aiTjVGG2fYLXxQBmvArhoUIwpBcFrTqLMag2O4tFe2t/PNohXRCC++Lj4HWmRsxQMYSbcKICDjsY2IbEi2bQLmpg= 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=Q0L8RuOQ; arc=none smtp.client-ip=90.155.92.199 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="Q0L8RuOQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=gMozlFeySij5N1pCmaGwXU/2mtJgmxyr5IyTRip9A1Y=; b=Q0L8RuOQyZzY7QUQbQ8SzZyc3q t/Kz5CDrTB/ovqy5uMajNj1nlLoKICfT5uHMegFqec5j9Ebpvtjz3pYJTY/omkTTEAGMwrTMi3gKU FjgTBOa8vbdbefpeWM/Clb6G8rGhjPf3eTrYcDtQ09EZ255Fd6fWDijaGzVp5aYBEQZsdJVwQOdsN seW0gxqk/IgwD8Xe1O8dPIVPX/oHh0kM3+a8mxUOps6spHtWFqJXBC/guSA0rAjo6u3hWf0RFoa2K DCyZI5hKOIaz42X4TGOoW0+VFpTa4BspWg+TP0Ax/VKtX1jH9IMJ+9x0zmbJ2O7bfAZrzy5BZwvBa i+jSX8FQ==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wFYUt-0000000BYhK-2YHn; Wed, 22 Apr 2026 14:24:11 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 07E1B3008E2; Wed, 22 Apr 2026 16:24:11 +0200 (CEST) Date: Wed, 22 Apr 2026 16:24:10 +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: <20260422142410.GS3102624@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> 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: 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...