From patchwork Mon May 15 06:38:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Jia X-Patchwork-Id: 93895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6720086vqo; Mon, 15 May 2023 00:02:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6n5aKnOWgBDcJmpgEaYmAAYGFNM6Q325MblvzQzqmplYhJLbgP26dS+u3XWOKPsAlJpPNa X-Received: by 2002:a05:6a20:42a5:b0:101:3046:8db3 with SMTP id o37-20020a056a2042a500b0010130468db3mr24832561pzj.22.1684134162693; Mon, 15 May 2023 00:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684134162; cv=none; d=google.com; s=arc-20160816; b=CO1zfEJ69bdl6MOQlORoEJNTFkYqHWYZvADMwUWxP1pg7Ll/KNkMQyPepB8J1m3rvk l17tmSm5jxN3R9fWBQrHrEvnOslXUM1fS5qNeobtsUfXk6kNu4kVjtjaaLpqfNeai4t+ /upjUnKrusiLOoulvAUgXoG5EvGPpBeAF5loH/zlErhIi2slqyjwQNA0u9jJZm55bOUU sNdMiROgNtUkapIBgHP41Q+bpvF3YF8OoA5GR63/NH1lYivXziUoA0yuudogW4VN/Qui EpL0MvgOAMsy/bL6RkDRrtoTJkTEMzESVAZYmugJnSshCsB6d/ClEcS+fKeNXUvfMyBL JYGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BFcJEKvFlaV29tECsJFbnfR2Mq9DuGUAZDWRZXZAow4=; b=kyCiFE+EKQcyyRfMfXkh239zOEn+35xdaLhY64XC8MKKwaK/KG955eCkZHvJrLUyKG DVK94TBSyXlW5c1i5f+EaYadvvotT1m2ivfxUlSxf3FcfCpdHoDGN56LHXvs4U3G3ti8 zlodf0ujBW4olIavz0ZCOiWJI49NFqMADsGOLoJ2vA4SO0SGUZNuwDQXHaeH+F8Z2q/C ap9Qo8lfvL4kKTSrO8Sr6v4RXodv8uCq1o9rHMsuRpS3d7AtI00dH8fOi2OVfkySJGAx +OsF/qiS9fSenoqAp3tsv4B0H2qpyXIZUvi4eTszBTRrRORN3PK7Ufi4aIHnbDFuH9XR /lEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=DGach8hc; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv187-20020a632ec4000000b0050726756edesi14688002pgb.76.2023.05.15.00.02.30; Mon, 15 May 2023 00:02:42 -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=@bytedance.com header.s=google header.b=DGach8hc; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239986AbjEOGjz (ORCPT + 99 others); Mon, 15 May 2023 02:39:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240097AbjEOGjs (ORCPT ); Mon, 15 May 2023 02:39:48 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55AF0E54 for ; Sun, 14 May 2023 23:39:25 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64a9335a8e7so18294833b3a.0 for ; Sun, 14 May 2023 23:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1684132765; x=1686724765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BFcJEKvFlaV29tECsJFbnfR2Mq9DuGUAZDWRZXZAow4=; b=DGach8hcIbmjALcZWCOjua9h8AAP0kcpM0lYtO03oqOMyG+KmL2Zz/Jy6cgdf/LU/h wVK2G45oppW+r9f1HQ8oNlr2Ny9PEGnU5uYweNqWl94msC4XgEiO+br3PjH9HeBYSXMw N/WcbNUyJPwG3LGxs0HznJHreo37AjGArhTpSOsqswLIgt5qqy8eQmB9ZNUgjTXjv4ES uRISkT1jiV91x5WdAaBRKj6T/hg963Kp3gjeF99a2AAHb21J1rABhMsfSXQRSn3M7H08 M7mfJf9JKS7VchWwimVfx6qXqSuvRJ1AeyFVP+7mNnlMfPxkNwDVfWWE+wbbF7WcR+Oi bCtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684132765; x=1686724765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BFcJEKvFlaV29tECsJFbnfR2Mq9DuGUAZDWRZXZAow4=; b=hCAJ5/bOIsvtGmncvQijoDreznA6ShDjIpceQwIByIavTIgG1a+o1dpzyCjGoed9cp az12sFvf7o0DbaUUfOQwwOYTqNWaNjDNWIId/NAs0VOn5OFYjdHJP17TAYrf+C/aJBMa B9pocR4F752a1EMXm8ialyF/TL6pKVQDFhjKxWblzH6PmrddkVQ6rAqbhaj4FcWJoFP/ 057mbrjKy8vjXnPPvp6vQS4gfrCpb8lD8rPFd2eFNZrKtVCyqGhdlWsx9UtRtqZ1Phu1 6Hhxn4Xhvr8u02NmM1uTGGnFne/nK6Tbw9qVWBbA4jW6tDmRMdtQsuDfHL6ZfHmpK1OR l91g== X-Gm-Message-State: AC+VfDxd0Pkp4ndXMTDts0hVX4ySgeg7Ui7SbGrPAqFwy+jao02KMTM9 BQ/B2RFV+MBOPRA6gGPENAK7dQ== X-Received: by 2002:a17:903:2343:b0:1ac:85b0:1bd8 with SMTP id c3-20020a170903234300b001ac85b01bd8mr26414078plh.34.1684132764854; Sun, 14 May 2023 23:39:24 -0700 (PDT) Received: from C02G87K0MD6R.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id t1-20020a170902a5c100b001ab01598f40sm12608543plq.173.2023.05.14.23.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 May 2023 23:39:24 -0700 (PDT) From: Hao Jia To: mingo@redhat.com, peterz@infradead.org, mingo@kernel.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, mgorman@techsingularity.net Cc: linux-kernel@vger.kernel.org, Hao Jia Subject: [PATCH v3 4/4] sched/core: Avoid multiple calling update_rq_clock() in unthrottle_offline_cfs_rqs() Date: Mon, 15 May 2023 14:38:48 +0800 Message-Id: <20230515063848.77947-5-jiahao.os@bytedance.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20230515063848.77947-1-jiahao.os@bytedance.com> References: <20230515063848.77947-1-jiahao.os@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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?1765942663519282692?= X-GMAIL-MSGID: =?utf-8?q?1765942663519282692?= This WARN_DOUBLE_CLOCK warning is triggered during cpu offline. ------------[ cut here ]------------ rq->clock_update_flags & RQCF_UPDATED WARNING: CPU: 0 PID: 3323 at kernel/sched/core.c:741 update_rq_clock+0xaf/0x180 Call Trace: unthrottle_cfs_rq+0x4b/0x300 rq_offline_fair+0x89/0x90 set_rq_offline.part.118+0x28/0x60 rq_attach_root+0xc4/0xd0 cpu_attach_domain+0x3dc/0x7f0 partition_sched_domains_locked+0x2a5/0x3c0 rebuild_sched_domains_locked+0x477/0x830 rebuild_sched_domains+0x1b/0x30 cpuset_hotplug_workfn+0x2ca/0xc90 ? balance_push+0x56/0xf0 ? _raw_spin_unlock+0x15/0x30 ? finish_task_switch+0x98/0x2f0 ? __switch_to+0x291/0x410 ? __schedule+0x65e/0x1310 process_one_work+0x1bc/0x3d0 worker_thread+0x4c/0x380 ? preempt_count_add+0x92/0xa0 ? rescuer_thread+0x310/0x310 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 The rq clock has been updated before the set_rq_offline() function runs, so we don't need to call update_rq_clock() in unthrottle_offline_cfs_rqs(). We only need to call rq_clock_start_loop_update() before the loop starts and rq_clock_stop_loop_update() after the loop to avoid this warning. Suggested-by: Vincent Guittot Signed-off-by: Hao Jia Reviewed-by: Vincent Guittot --- kernel/sched/fair.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index af9604f4b135..9e961e0ec971 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6124,6 +6124,13 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq) lockdep_assert_rq_held(rq); + /* + * The rq clock has already been updated before the + * set_rq_offline() runs, so we should skip updating + * the rq clock again in unthrottle_cfs_rq(). + */ + rq_clock_start_loop_update(rq); + rcu_read_lock(); list_for_each_entry_rcu(tg, &task_groups, list) { struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)]; @@ -6146,6 +6153,8 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq) unthrottle_cfs_rq(cfs_rq); } rcu_read_unlock(); + + rq_clock_stop_loop_update(rq); } #else /* CONFIG_CFS_BANDWIDTH */