Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4489709pxb; Tue, 31 Aug 2021 06:31:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHSWAA7Nsmt5megWgYPFoJgHNRw2ANQ7Bgtrvq6DlS3p+4Y1IrGo2pidWYE20HqtCisDbM X-Received: by 2002:a17:906:1b14:: with SMTP id o20mr31408037ejg.154.1630416701773; Tue, 31 Aug 2021 06:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630416701; cv=none; d=google.com; s=arc-20160816; b=EUS4wnQ/Y9YaamO9z9ubcrUkArsXhg0g2wFsq14IM/J1soX6L4haXeOuOtY9GU2JG+ cBpOCRBwTpUFQqbmV5M05ER1IZbqqQxqsrcZvCyFtyqwy25ZOqL++ifjIj66O1EIoIqs 5Jii0N4el9mv40aX2FfZAuYse+C4HP8krzKjq3bEblV0LtSh8mW7zL7E0FiQ1YM06/fa ydQu4QWTiJLKlnUW1BXaWDINtOvBtJ+okUrWwHEbUNXZplVhNHRs5BXk+Irm+Rv4XTgl /slLxjvFJ8QsLhTp92/1WxBCs7LyvekP/9/E/sk5RLdrMSAhjOqatziKj0ND3e1wsdDQ mZ9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GAjUavHb+mKCA+LR8XMdkthAV445J68UiBOR63afig8=; b=DRD4pFlk4tzf7ngcQplcczwe8qKfpEcG2Dd8ZwOoZH2h9CfitKBKVlSjdXnZoQsBGa oZ/H9PBvRJWMtjiIFqDi2uhB1AaYwP8xwsNZdbky9nbBKDOwE/7bh9L+ND97uFgC3/y5 +f50OOggQFp5EjNnYmktvbcd8wA0+udlHWNZB1+n87hzn1aqkyiVmuI0XIpVJa6I4Ro/ 98n3XxvXog+Kbza6KP0bzWtmdE+xL//2/iXgi/kEE/tKl+unufKhGMy6EEKHiTFGIY8I oH6WpXTPL4brbpCBfdexpQnp8VkTsWwkNhcTyVE2mzPEUG/1OGALVpddduOkLkDqCEDn kegw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xjr+jfs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c6si17899184ejc.71.2021.08.31.06.30.59; Tue, 31 Aug 2021 06:31:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xjr+jfs7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235477AbhHaN3P (ORCPT + 99 others); Tue, 31 Aug 2021 09:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235281AbhHaN3D (ORCPT ); Tue, 31 Aug 2021 09:29:03 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F3EBC061575; Tue, 31 Aug 2021 06:28:08 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id v2so19876701ilg.12; Tue, 31 Aug 2021 06:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GAjUavHb+mKCA+LR8XMdkthAV445J68UiBOR63afig8=; b=Xjr+jfs7WbfMHS9FcwQG7T8a777R6OZrkDqW4AIM/t9r78+dCb8YBTRtSek12TZfm6 BfO4DED3U9hqQh+RhkqZUJIkG8KRXvhhFfecaradgrLMg5GrFoec+XYM5EsndB9MOJqA vGKJKHBfY/4Sca0wm4JT1LiaZ9Ga38jxxMQDngHuQTFbli9UTGXedbEb+HF1Z8mRkQ5G S3901as2Q3U3S07ocQRkWLMuStaj3CVOwkADUXKVovhAIurY86pqKDNLSYltLVifTD4x 9b7Ub1+8BSBUgtWayaNxyOmeInSFym28CWNHwEwvXCvyXYVhxFSngzu8egPFH1YXG8OL jIGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GAjUavHb+mKCA+LR8XMdkthAV445J68UiBOR63afig8=; b=WApBhx4aDC8o5HnKqcOF/QlaJIcqn7YolnbPBIjx5zaeQJcJvWO4PffUEngZ7lQ7OX djA3NZYvXZQ79ZyWCVSELTA0fo2sc9mhU70zz8SxAutfwegZTZ4TEas642OPXLxY92/6 m1UxpbKbdgG84i2EZFxw+7jKQBPl8igEZjEn79OPmD/xguGEDvXD9RXvzaoIrbgg0lVs FLCNdv7V8DEIyn5xqACU4IoCdh3fLKQ9/zDUTLQEYk1rl8A12qnC1vw9JkJ83W+87Pqt D0hwwvz6NpV2XJunSTqjQPsq4R6jeIBo6rIGByuIA/OM/2li4kjR2gT1JbnMqu+WsGx2 GDcQ== X-Gm-Message-State: AOAM530OBXIzQZVWD3IplnCT0iobFQRgSWMQkIxmx6MTx6yVNARXjpIy syOwzwHkFOBACQbG+MaVR0dHaMGUKRj8l2Xg7ec= X-Received: by 2002:a05:6e02:524:: with SMTP id h4mr20244874ils.203.1630416487805; Tue, 31 Aug 2021 06:28:07 -0700 (PDT) MIME-Version: 1.0 References: <20210824112946.9324-1-laoar.shao@gmail.com> <20210824112946.9324-4-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Tue, 31 Aug 2021 21:27:31 +0800 Message-ID: Subject: Re: [PATCH v3 3/7] sched: make schedstats helpers independent of fair sched class To: Peter Zijlstra Cc: Ingo Molnar , Mel Gorman , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Benjamin Segall , Daniel Bristot de Oliveira , Alison Chaiken , kbuild test robot , LKML , linux-rt-users Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 7:08 PM Peter Zijlstra wrote: > > On Tue, Aug 24, 2021 at 11:29:42AM +0000, Yafang Shao wrote: > > diff --git a/kernel/sched/stats.c b/kernel/sched/stats.c > > index 3f93fc3b5648..b2542f4d3192 100644 > > --- a/kernel/sched/stats.c > > +++ b/kernel/sched/stats.c > > @@ -4,6 +4,109 @@ > > */ > > #include "sched.h" > > > > +void __update_stats_wait_start(struct rq *rq, struct task_struct *p, > > + struct sched_statistics *stats) > > +{ > > +u64 wait_start, prev_wait_start; > > indent fail... > Sorry about that. It is strange that my checkpatch.pl didn't find this issue... > > + > > + wait_start = rq_clock(rq); > > + prev_wait_start = schedstat_val(stats->wait_start); > > + > > + if (p && likely(wait_start > prev_wait_start)) > > + wait_start -= prev_wait_start; > > + > > + __schedstat_set(stats->wait_start, wait_start); > > +} > > > diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h > > index e6905e369c5d..9ecd81b91f26 100644 > > --- a/kernel/sched/stats.h > > +++ b/kernel/sched/stats.h > > > @@ -40,6 +42,33 @@ rq_sched_info_dequeue(struct rq *rq, unsigned long long delta) > > #define schedstat_val(var) (var) > > #define schedstat_val_or_zero(var) ((schedstat_enabled()) ? (var) : 0) > > > > +void __update_stats_wait_start(struct rq *rq, struct task_struct *p, > > + struct sched_statistics *stats); > > + > > +void __update_stats_wait_end(struct rq *rq, struct task_struct *p, > > + struct sched_statistics *stats); > > +void __update_stats_enqueue_sleeper(struct rq *rq, struct task_struct *p, > > + struct sched_statistics *stats); > > + > > +static inline void > > +check_schedstat_required(void) > > +{ > > + if (schedstat_enabled()) > > + return; > > + > > + /* Force schedstat enabled if a dependent tracepoint is active */ > > + if (trace_sched_stat_wait_enabled() || > > + trace_sched_stat_sleep_enabled() || > > + trace_sched_stat_iowait_enabled() || > > + trace_sched_stat_blocked_enabled() || > > + trace_sched_stat_runtime_enabled()) { > > + printk_deferred_once("Scheduler tracepoints stat_sleep, stat_iowait, " > > + "stat_blocked and stat_runtime require the " > > + "kernel parameter schedstats=enable or " > > + "kernel.sched_schedstats=1\n"); > > + } > > +} > > If you're moving this, you might as well reflow it to not have broken > indentation. Sure. -- Thanks Yafang