From patchwork Thu Apr 6 10:05:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 80175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp914178vqo; Thu, 6 Apr 2023 03:24:24 -0700 (PDT) X-Google-Smtp-Source: AKy350b5GoePwICQlEr6MP8JapKw6xpaG8r07TXQqcRRIe03MWaZQl18EmFR2ozI6zagprkqtkCu X-Received: by 2002:a17:906:6bc4:b0:931:86cf:9556 with SMTP id t4-20020a1709066bc400b0093186cf9556mr6254996ejs.23.1680776664698; Thu, 06 Apr 2023 03:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680776664; cv=none; d=google.com; s=arc-20160816; b=JhDQAoo6vRq5aPZJX6hRgCiRVUw3/CmccDboeFz5UihMawrabihF6gcd5ROm5odDlZ JvDu7K0Mfw40R2bq/fXSJLNklN8SNgOIuVFJ5cH/Nct+yyGnrPn/amWuP0zDIB9x2mRK ulKKM40+7+z7W9uqvelh19w9uUZZsNkRlzhk5FpndUn3Y71xyeHgjpsWm4aQDyVrStIQ Bhc094sAoYxy8lL5xPGB97+xLRqBXeZAwnrI8bN9iCRJUvRIiajQe+AaZGsSZBTiVpcF rxPb46HoTLotbHbzZL/Pp51zVo8fAQsmENV32t7ztogQEb58r4jLzBC9NgwJBXUZOLmQ 5iMw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a1709067e1100b009486e9c2733si820226ejr.337.2023.04.06.03.24.01; Thu, 06 Apr 2023 03:24:24 -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 S236760AbjDFKFs (ORCPT + 99 others); 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762422072189147847?= X-GMAIL-MSGID: =?utf-8?q?1762422072189147847?= 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,