From nobody Wed Feb 11 10:58:47 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BDBFC76196 for ; Thu, 6 Apr 2023 10:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237087AbjDFKFs (ORCPT ); Thu, 6 Apr 2023 06:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236622AbjDFKFU (ORCPT ); Thu, 6 Apr 2023 06:05:20 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75CF92727; Thu, 6 Apr 2023 03:05:19 -0700 (PDT) Date: Thu, 06 Apr 2023 10:05:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1680775518; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2GFJ1KgWCYMCP8ag70cl83o6IW655tDj0gST7iBEuUQ=; b=Uo7FuSv36y4C7X2FbYDiPa3ml4hKkZUGAGFMcVP9fuKTzmJxLtPZJZzJg4wMZSOQOyVPXB ciZ4D84pqn2FicmFmFdGKcMfq9O1L0CP3sKS2kH8Hsx8E7yX2X4k56m3b9SdwOJjvgVmbu vo6m2LlHgXMmpdR5DdrT/bt9DJfAJcH5XULaosLqNMBylVzIRT42Zj+1kE0Z2i1IiZyU7d Q6C3vG7tSzrPYU5eZYrfd17evflcbiVLTUFq65a5zmWjmFIjMHCYmue/Iuqd7SAvVle4Ea FJaSrmeiXBONye0PnNo8/yFyxSMBxcGDTfq5pb5o+ZSVBTg8DIdKqgT/df0H2w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1680775518; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2GFJ1KgWCYMCP8ag70cl83o6IW655tDj0gST7iBEuUQ=; b=11a+pjG9H/nJy+RVK4JOUAWrvVzJehelHsoSwstGs6i9Bc7geG6B6mlXpVDiFB7a1Hl0Y2 eA/+J+ZXSroGinDA== From: "tip-bot2 for Domenico Cerasuolo" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/psi: Extract update_triggers side effect Cc: Johannes Weiner , Domenico Cerasuolo , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230330105418.77061-4-cerasuolodomenico@gmail.com> References: <20230330105418.77061-4-cerasuolodomenico@gmail.com> MIME-Version: 1.0 Message-ID: <168077551773.404.15307578031838005119.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 4468fcae49f08e88fbbffe05b29496192df89991 Gitweb: https://git.kernel.org/tip/4468fcae49f08e88fbbffe05b29496192= df89991 Author: Domenico Cerasuolo AuthorDate: Thu, 30 Mar 2023 12:54:17 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 05 Apr 2023 09:58:49 +02:00 sched/psi: Extract update_triggers side effect This change moves update_total flag out of update_triggers function, currently called only in psi_poll_work. In the next patch, update_triggers will be called also in psi_avgs_work, but the total update information is specific to psi_poll_work. Returning update_total value to the caller let us avoid differentiating the implementation of update_triggers for different aggregators. Suggested-by: Johannes Weiner Signed-off-by: Domenico Cerasuolo Signed-off-by: Peter Zijlstra (Intel) Acked-by: Johannes Weiner Link: https://lore.kernel.org/r/20230330105418.77061-4-cerasuolodomenico@gm= ail.com --- kernel/sched/psi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index a3d0b5c..f3df6a8 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -430,11 +430,11 @@ static u64 window_update(struct psi_window *win, u64 = now, u64 value) return growth; } =20 -static u64 update_triggers(struct psi_group *group, u64 now) +static u64 update_triggers(struct psi_group *group, u64 now, bool *update_= total) { struct psi_trigger *t; - bool update_total =3D false; u64 *total =3D group->total[PSI_POLL]; + *update_total =3D false; =20 /* * On subsequent updates, calculate growth deltas and let @@ -462,7 +462,7 @@ static u64 update_triggers(struct psi_group *group, u64= now) * been through all of them. Also remember to extend the * polling time if we see new stall activity. */ - update_total =3D true; + *update_total =3D true; =20 /* Calculate growth since last update */ growth =3D window_update(&t->win, now, total[t->state]); @@ -485,10 +485,6 @@ static u64 update_triggers(struct psi_group *group, u6= 4 now) t->pending_event =3D false; } =20 - if (update_total) - memcpy(group->rtpoll_total, total, - sizeof(group->rtpoll_total)); - return now + group->rtpoll_min_period; } =20 @@ -622,6 +618,7 @@ static void psi_rtpoll_work(struct psi_group *group) { bool force_reschedule =3D false; u32 changed_states; + bool update_total; u64 now; =20 mutex_lock(&group->rtpoll_trigger_lock); @@ -686,8 +683,12 @@ static void psi_rtpoll_work(struct psi_group *group) goto out; } =20 - if (now >=3D group->rtpoll_next_update) - group->rtpoll_next_update =3D update_triggers(group, now); + if (now >=3D group->rtpoll_next_update) { + group->rtpoll_next_update =3D update_triggers(group, now, &update_total); + if (update_total) + memcpy(group->rtpoll_total, group->total[PSI_POLL], + sizeof(group->rtpoll_total)); + } =20 psi_schedule_rtpoll_work(group, nsecs_to_jiffies(group->rtpoll_next_update - now) + 1,