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 45D5A313E11 for ; Fri, 14 Nov 2025 12:13:57 +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=1763122440; cv=none; b=rP55/1aDZXSi4Ax0wCcVaOBqUEw8gaJVLkozY0CmceRGZwfFsUhPXXHoTX0CbVn+PiYNToRS5Nl1SmkhnbxK6bjkJ/QYW6aP6UqHhW42RkkM1vzKAOcTE7jTsrsA8YOb1Xpqsfsy2ycISBNNTBxk/jEHt7MD+wRc5wFzw1QZ1Dw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763122440; c=relaxed/simple; bh=KKHDiureAkVMVeDH/HnjwInsvE379Rc+oek/r4e2V3E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TzF7yHIu3U4nU737XE0ZuYdkalydmgosn+S8M0bQcOZm50kBWV/xjnaxyADKm0LI84okrN0NKbhkRpO3ny6HItPZtiFtYU4xpTEU1DJ46lUFIOISvPrJAQ8Dld1QupsDJQAQQmpSoyhACiNJiKBVMURRVMjtdDSsfP6ELmSZFYI= 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=W4YfQK2r; 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="W4YfQK2r" 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=L5GVtIsQM/iwbGM15i7FW5Fcre8HKYCybidkFGIZ9eA=; b=W4YfQK2rDMdKRGJIsuFq0z/tH3 RaC/r+GQdhPBc23L6ZDr3/1gLbr4YDOXc8Ci1RIfgqr9fLaQvqy2iX9NGRaQyr9bYOyk+Eia6jhbN e/5niH+u+RoodVt7IlEPUsj9o04c9HtgOjuANxY16qnsP2Urp//ZjD9LGEH02CY4isDWu25l8FFSj fBrOfTgI2DZDCSjOH/fsPZNHafFqNae/3/PsIM7w+hFN5jWrTKrQWQyOEbDcVzmJddn81t4u7Gh2b +mWePujVsIhrHBYCRDrZPE1oxc+Wuxc/Alz/MhAbKBiBz2CUSvYB+jznlj6wdzm2eQSQoEXVUmSze nO3ZAW7A==; 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 1vJsgY-00000009Ewq-45bq; Fri, 14 Nov 2025 12:13:51 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 72AB130023C; Fri, 14 Nov 2025 13:13:49 +0100 (CET) Date: Fri, 14 Nov 2025 13:13:49 +0100 From: Peter Zijlstra To: Mel Gorman Cc: Ingo Molnar , Juri Lelli , Dietmar Eggemann , Valentin Schneider , Chris Mason , Madadi Vineeth Reddy , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] sched/fair: Reimplement NEXT_BUDDY to align with EEVDF goals Message-ID: <20251114121349.GG4067720@noisy.programming.kicks-ass.net> References: <20251112122521.1331238-1-mgorman@techsingularity.net> <20251112122521.1331238-3-mgorman@techsingularity.net> <20251112144823.GE3245006@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 Thu, Nov 13, 2025 at 09:04:38AM +0000, Mel Gorman wrote: > On Wed, Nov 12, 2025 at 03:48:23PM +0100, Peter Zijlstra wrote: > > On Wed, Nov 12, 2025 at 12:25:21PM +0000, Mel Gorman wrote: > > > > > + /* Prefer picking wakee soon if appropriate. */ > > > + if (sched_feat(NEXT_BUDDY) && > > > + set_preempt_buddy(cfs_rq, wake_flags, pse, se)) { > > > + > > > + /* > > > + * Decide whether to obey WF_SYNC hint for a new buddy. Old > > > + * buddies are ignored as they may not be relevant to the > > > + * waker and less likely to be cache hot. > > > + */ > > > + if (wake_flags & WF_SYNC) > > > + preempt_action = preempt_sync(rq, wake_flags, pse, se); > > > + } > > > > Why only do preempt_sync() when NEXT_BUDDY? Nothing there seems to > > depend on buddies. > > There isn't a direct relation, but there is an indirect one. I know from > your previous review that you separated out the WF_SYNC but after a while, > I did not find a good reason to separate it completely from NEXT_BUDDY. > > NEXT_BUDDY updates cfs_rq->next if appropriate to indicate there is a waker > relationship between two tasks and potentially share data that may still > be cache resident after a context switch. WF_SYNC indicates there may be > a strict relationship between those two tasks that the waker may need the > wakee to do some work before it can make progress. If NEXT_BUDDY does not > set cfs_rq->next in the current waking context then the wakee may only be > picked next by coincidence under normal EEVDF rules. Aah, fair enough. Perhaps the comment could've been clearer but whatever.