From patchwork Tue Oct 31 12:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 160106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b90f:0:b0:403:3b70:6f57 with SMTP id t15csp216848vqg; Tue, 31 Oct 2023 06:00:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEquY7cGI8+VGt+5hgpj9n3nZvruVK5LHZu35I9jQMAIPvIIuITR3LIZnml81kDIP6+gwwo X-Received: by 2002:a05:6e02:198b:b0:357:9ec8:87f1 with SMTP id g11-20020a056e02198b00b003579ec887f1mr19216953ilf.1.1698757254494; Tue, 31 Oct 2023 06:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698757254; cv=none; d=google.com; s=arc-20160816; b=ZXew0v2eh7dv+6Qhs0VKy7O/I7m7nIDQcrL/mhOFpN5K298jhYgZh67nMrF56PTHKD pThHpFYLhbwfVDwPU8Z/GAsnReQGtdiRptd3/m4TPut7zxTma6RIa/XY9tiJ9xSSZBgs XjCJYzoMXeRWPZb17fUxKT7norwy7yU0ZLZ7kW9E16hm73O2ydqQvuCPgkr55QocNK8V wx3H3foU4W1nqL4f4FV0mhpd8cyouvRf2SOf7x+S8iCOiiHNy6roB1QkehPBOGenebkq zHUcKyoUmDeo2ga6EVsrxEbnyNyiv1P+EE5npHPuBB0sraDmkUg3qECoM9ewkVDpql+v Ttrw== 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=/sO/0GN20MYb/vNaKkzhBBtk0+YYiOECkhCnCZjqjhI=; fh=kY5sJNvn29qhEh2SatEVpXE2cTkcQ8AnU+xu9Bnn8Ic=; b=j5Y/HzW46sUsQTJ4b77DnkaWiDZwnYA3BC1DVRyq3QQTkqQdoyuOvyjc8l3QsIIOM1 Oh4LpsPiJNbEQwFqA+p3RW+PoogkVA258XRS1ZnlyI2VN78xXsue1sc7KkaO8/vluOIP FAmy60dmVJXhlbPw6GI8qZjplsy2X6TW8ftEemm4B+tmhBlwmLHbrIxBEtsbDwNCJObP sfXh7El+VPVubXcgHsypEyzPMcnW3OqJ8FvA4wWWY8X2qgI/oZPrr4HGY+IZ6tWydjMq eUSqpjtVVHJNUQYmcE+H79RGl5Ed9g90IiI/HCVclQhyDVXwr9TBQYWnpQ5xxj11yCFw oblw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lisl5PHv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e8-20020a656bc8000000b005b4a9b2f404si1033905pgw.710.2023.10.31.06.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 06:00:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lisl5PHv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5313B8076E62; Tue, 31 Oct 2023 06:00:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344414AbjJaNAP (ORCPT + 33 others); Tue, 31 Oct 2023 09:00:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344417AbjJaNAO (ORCPT ); Tue, 31 Oct 2023 09:00:14 -0400 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 896DCEA for ; Tue, 31 Oct 2023 06:00:11 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1698757209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/sO/0GN20MYb/vNaKkzhBBtk0+YYiOECkhCnCZjqjhI=; b=lisl5PHvh0WYFyUnrtBihMVHL0yL31Xhwkl7H6OVMudPPWdfH9gKGOwiTbyIH2ntZzlO+b y9sMXRR4kUMcpL9A0QiyDSbAdKayPDWEcebo59oOOrWdaPvyq7czi5+J0/7JlorkMXsD/B J+4wQke+ZlRprsuD4m4Ao2MjrPgU49M= From: Yajun Deng To: mingo@redhat.com, peterz@infradead.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 Cc: linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH v3 2/3] sched: Don't trace stat runtime for task group Date: Tue, 31 Oct 2023 20:59:27 +0800 Message-Id: <20231031125928.235685-3-yajun.deng@linux.dev> In-Reply-To: <20231031125928.235685-1-yajun.deng@linux.dev> References: <20231031125928.235685-1-yajun.deng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 31 Oct 2023 06:00:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781276086689821939 X-GMAIL-MSGID: 1781276086689821939 The rt entity can be a task group. We will trace stat runtime for each task, so we don't need to trace stat runtime for task group. Move trace_sched_stat_runtime in update_current_exec_runtime. Signed-off-by: Yajun Deng --- v3: New patch. --- kernel/sched/deadline.c | 2 -- kernel/sched/rt.c | 2 -- kernel/sched/sched.h | 1 + 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index a9f84428c4b5..70b5c5b47106 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1301,8 +1301,6 @@ static void update_curr_dl(struct rq *rq) schedstat_set(curr->stats.exec_max, max(curr->stats.exec_max, delta_exec)); - trace_sched_stat_runtime(curr, delta_exec, 0); - update_current_exec_runtime(curr, now, delta_exec, true); if (dl_entity_is_special(dl_se)) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 79cf80d73822..1e155c7658ae 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1016,8 +1016,6 @@ static void update_curr_rt(struct rq *rq) schedstat_set(curr->stats.exec_max, max(curr->stats.exec_max, delta_exec)); - trace_sched_stat_runtime(curr, delta_exec, 0); - update_current_exec_runtime(curr, now, delta_exec, rt_entity_is_task(rt_se)); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 6f0169d9b306..f7014e19bc0a 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -3268,6 +3268,7 @@ static inline void update_current_exec_runtime(struct task_struct *curr, curr->se.exec_start = now; if (task) { + trace_sched_stat_runtime(curr, delta_exec, curr->se.vruntime); account_group_exec_runtime(curr, delta_exec); cgroup_account_cputime(curr, delta_exec); }