Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1906254rwl; Thu, 6 Apr 2023 03:06:18 -0700 (PDT) X-Google-Smtp-Source: AKy350aJ+YljxcS98904r38hYwtv3UPHO2LaP9O/h/nTADs1hPI+v1tOiPYgL2FN7Pb7qKu0r1TF X-Received: by 2002:a05:6a20:4c06:b0:db:4fae:ad15 with SMTP id fm6-20020a056a204c0600b000db4faead15mr2504426pzb.42.1680775578054; Thu, 06 Apr 2023 03:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680775578; cv=none; d=google.com; s=arc-20160816; b=JA7zIgbNah5kMvZajnf3AkvfYwxx8CxX2H0u/yGMIB3szyUxf9I9wxS3+KlKn9uNuy ZB2eD2TPBfAgAtA1VbnacL0MTcymHkdC0/gNGaEcsw7Py/oHifl8FYTIFQg0E6Zr3rhJ XcHf8+l96NA6ZygGMOwE+r8ZGfnPH2MPI2ppaSifwQrkzGarWDgULZ6GhiiTydXD+Vo7 l03H2FmGnuS1jxIr3llnlB31uCwQFkGWqHfh83ayBQkrEnUxGSBOyIbXuQbGQRgfIt2s 0y+s65UWBUyUUH7uUzbBYn4RZYjxdf6O0aMF+1mOliRvcMPfrAzTMsC5toFhHSdkV94K YgQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=2GFJ1KgWCYMCP8ag70cl83o6IW655tDj0gST7iBEuUQ=; b=m6KGeF9h2meDhvmqy8rFFVqMuOxzk+C86mLGOQ+1/Apb84koY5pCDVryrmwRJ83c7e hGFpnMYEKviz2XZtBCHJ8ODxHRriwWRAbmCb9ku+z++nPWDZTsYOi/gcijQgidn4StYg q5Xg5cu0HBN4M6s7IuaHqzrqIWU1v0lA15A88rlgBhB6nYFidedBRA10nchJdunI1cdf IUACnAY8y6joHrSinSz1B+1kuANIOtG64YthzzYDogcFyJDIcocfHfPSgxfMVWPRGbH2 II+CWbOJFSgUwpBYfKdSu6dPvpBP50UGHsU+BBLSdDZFDiCt4Oh2vMPloSChFxdjbLgW kiZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Uo7FuSv3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=11a+pjG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a6543c7000000b005032da21acasi926899pgp.204.2023.04.06.03.06.06; Thu, 06 Apr 2023 03:06:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Uo7FuSv3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=11a+pjG9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237073AbjDFKFr (ORCPT + 99 others); Thu, 6 Apr 2023 06:05:47 -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: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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/4468fcae49f08e88fbbffe05b29496192df89991 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@gmail.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; } -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 = false; u64 *total = group->total[PSI_POLL]; + *update_total = false; /* * 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 = true; + *update_total = true; /* Calculate growth since last update */ growth = window_update(&t->win, now, total[t->state]); @@ -485,10 +485,6 @@ static u64 update_triggers(struct psi_group *group, u64 now) t->pending_event = false; } - if (update_total) - memcpy(group->rtpoll_total, total, - sizeof(group->rtpoll_total)); - return now + group->rtpoll_min_period; } @@ -622,6 +618,7 @@ static void psi_rtpoll_work(struct psi_group *group) { bool force_reschedule = false; u32 changed_states; + bool update_total; u64 now; mutex_lock(&group->rtpoll_trigger_lock); @@ -686,8 +683,12 @@ static void psi_rtpoll_work(struct psi_group *group) goto out; } - if (now >= group->rtpoll_next_update) - group->rtpoll_next_update = update_triggers(group, now); + if (now >= group->rtpoll_next_update) { + group->rtpoll_next_update = update_triggers(group, now, &update_total); + if (update_total) + memcpy(group->rtpoll_total, group->total[PSI_POLL], + sizeof(group->rtpoll_total)); + } psi_schedule_rtpoll_work(group, nsecs_to_jiffies(group->rtpoll_next_update - now) + 1,