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 D72E926158C for ; Mon, 2 Feb 2026 20:41:50 +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=1770064912; cv=none; b=bS20Yc7hqv/Lb/3sBgJkasR3mIFaQgpBKV5D/Oke8RYo5JDk2uML+06xJE/8r4v2rJO/Zxp/V0ctJOgodcMu8i7eYSe0TCOLX+Hdb1fDRYNDBVVwsco5ui2n5EZE/zcGfhBdagJrmeRCQATF740t+TkGtv24ydlDRyGZLTPrwb4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770064912; c=relaxed/simple; bh=emws7WWP3q9w7xetRCkeJOw/yWgQEoh9s/rnS8Q2wn0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SafW6T3oveYTJ/n2qb+CryKy9QOcKBkls9emd2i5apd7gEeOtudkH/tou9aj0F0RDs/rmK6WdtHYw/zXF+YzJHdtl79XfDVyvjLTZ+eVQA4h81WsXkvxUTXP74L6QIG6HJ7ZBphI1o/OIAXoUQKAvBCLC4/fsbqjOYVUugiIASY= 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=jKIK3Y/J; 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="jKIK3Y/J" 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=sPYtoPpxqCCZRWpK6PtFoj+mAMpLdaWvH9kCrRcsbkU=; b=jKIK3Y/JgcRi7jam/OKuaN4a5W g2OkRIONMgKKmVaBWsuwCguAuyJUTOF752Qx33U3a3jkEg94M/oTKaCb3delIyjNPEL6a3PCC5dbX TxXOUzgpcT5O5K80OkaDiI5ih9W1nv61Rbd7pAVC+ufvQW8brj+XPcjNMfqNvXVuKVHaby3kKYaxR sjQdxQnLB/PDteJ0ts7OoIFSgpX4hTOe7I5IpjZ2TX2+yKlJZmItVPlYJ1SuwFMpLShjClX42IlU5 1qLkugdSwC97hr18dN2cYs76WOddrjLJqbWEiaDqycPmMNsW+uqz3r21GsynYwnwGMNa6wdbir+IT 0N7zP1Bw==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vn0jp-0000000FB2o-370g; Mon, 02 Feb 2026 20:41:40 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 478223008E2; Mon, 02 Feb 2026 21:41:37 +0100 (CET) Date: Mon, 2 Feb 2026 21:41:37 +0100 From: Peter Zijlstra To: Johannes Weiner Cc: Suren Baghdasaryan , Ingo Molnar , Chengming Zhou , Dietmar Eggemann , John Stultz , linux-kernel@vger.kernel.org Subject: Re: [PATCH resend 2/2] sched: psi: use rq_clock() during task state changes Message-ID: <20260202204137.GK1395266@noisy.programming.kicks-ass.net> References: <20260114154317.1815429-1-hannes@cmpxchg.org> <20260114154317.1815429-2-hannes@cmpxchg.org> 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: <20260114154317.1815429-2-hannes@cmpxchg.org> On Wed, Jan 14, 2026 at 10:43:17AM -0500, Johannes Weiner wrote: > In the hottest psi paths, the scheduler already caches the cpu_clock() > call for the event in rq->clock. Now that the clocks between state > changes and pressure aggregation don't need to be synchronized inside > the seqcount section anymore, use the cheaper rq_clock(). > > Add update_rq_clock() calls to the few places where psi is entered > without the rq already locked. Just to be clear, rq->clock is not a cache of cpu_clock(). rq->clock discards all backwards motion (which obviously should never happen, but if it does, the clocks go out of sync). So if you use rq->clock, you must use it for all and not mix with cpu_clock(). I *think* the patch does that, but I've not double checked.