Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4463482pxb; Tue, 31 Aug 2021 05:59:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNyV376ldFJjqACWhQphmfIse4BydPvNCvpPyS+zbMRfV/BVoAm9JhmL+HrTEvzPMYeF+h X-Received: by 2002:a05:6e02:1846:: with SMTP id b6mr21201386ilv.264.1630414773791; Tue, 31 Aug 2021 05:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630414773; cv=none; d=google.com; s=arc-20160816; b=PhxfmDPWG5QObxdBchccQ/xz2jSwQix61D4sYATu9VlAsoyEbz9pCfhiF18AcrlN16 SL9gOb0Zh021FneVudPmZwUQXkJSdyI4tKGJcymuEnI4un2kIf5FlHay4jClCuuWR0UG CQp/er2zzX0cvZ0I9RcX4ov6Rzc5/OY/32JqdTXBBkkiNGYPZao4gvtTYnfDFUC7RQ/y Y1vHqFgYHWa71tUpXEDqzyM0pKOIPI4rorDSu4QEb7Yql0AvZPSfRBX4rUvEKWrE2D/o nOFknkWYArGmdsQNrJQujIwcqVLId4Xy4+Q+qXurwmfNPcJFoxipL2CP+Ob9x3SuFCG1 DDZg== 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=dWS+Ij/B65eWiJaIgZALxxXVNQmfq8edX/IwCYp9o1A=; b=VCcxTV3ZJmCs1uaIVJUExD+WSFNNDK1Q02Doies4RmhVKQNr01a3weSubebfheaFoW YOt2OsK8VcZMeFOPA+KEvVv4d4nlShXLzWdpoj5hby3pH+eyfjj96omCIkU8Sql8gqM4 ejkO7niUrWosOCxdZsKi5lVFZqLeQr0udBVtEBrCJ1GluiiPh2a2kOP96+Yrntf75Pvo cS8UdAEwYSZDz3g+q2IIoUiWV/WKwK+hA1Lvw4Et8zUBGgnmHQOEIan/fziIO5wkULLi a/m4765MC9qRGW6XGo8dxYF5wxa2k3mEOjzFqOVOjMaosuWPQ6lQFFJrYXo/DfNrVEbg QnRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KiPA5qm2; 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 k20si18089061iog.64.2021.08.31.05.59.22; Tue, 31 Aug 2021 05:59:33 -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=KiPA5qm2; 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 S232838AbhHaM7Y (ORCPT + 99 others); Tue, 31 Aug 2021 08:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232956AbhHaM7P (ORCPT ); Tue, 31 Aug 2021 08:59:15 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471BFC061575; Tue, 31 Aug 2021 05:58:20 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id b4so19793803ilr.11; Tue, 31 Aug 2021 05:58:20 -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=dWS+Ij/B65eWiJaIgZALxxXVNQmfq8edX/IwCYp9o1A=; b=KiPA5qm2NcuzbK2V6DVsCrjTveYWaH9NIeo1a5PrjQyHagXTPtNFS9HEP1xr0abNrG Ull3Hfs9nzJ54H3/OiqrIc7YyXfQcMg5SAHarAovL2tYx87/2VngW308BOmtFQSrgZbf V5+K2u3N6vXRq/pYj7rZJGE4ORnyACoXLA9JBqfLPVsltkoB6qACP2WNKdctGG11wpex R/dEcOKc0KBXYJgGGAcayCHX/n+Y7sdbRKydg/fM4pbRLMKC/EHAyl8nebtJPPdaYg3v imTbM0MP5SjsiJ8AY368wwfQF71siJiM8lTAP0iCU50X56QEMWQlBr6qFjHP9l3zbfLt BwOA== 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=dWS+Ij/B65eWiJaIgZALxxXVNQmfq8edX/IwCYp9o1A=; b=QlRCu3RRvHISErNoTo0wChDwhclrY5+PLNCM7XjIY8ER+408d1NJyh1UnknDuQsqY6 LtTwWaoDo54101WL4U2ozfnU8zLhwrmp6kGshY4IPMA+U68J7kchmeDzt8o+6CCP91wm goQ/HHRbC82I2zndYUcM0BJnPWp9zi1G+z5VUdvZbV41CjdKoF+zlBoxgdU7pzfrpFh4 Zu6WzTA96TKS14L8aoMrWq4dttK/9ykO2sLUTJ1VstDlhG0uz+I4XcWfK94Gxc44TR5F 3ENkzyXXqhvWaOaxsYV8psNWkkC7hKDcKdsZZct+UImFOqfTCp4qlHZW+8BuiHvtBV8i mswA== X-Gm-Message-State: AOAM532VM945lclbuKUhufY3/n1tH1KT+SkbuTOFLmbS1ljaLwrLH1yk 3igHyV5SuopZFph/O37ToaYv+ugTEdJBRVLQ1dw= X-Received: by 2002:a05:6e02:524:: with SMTP id h4mr20142203ils.203.1630414699713; Tue, 31 Aug 2021 05:58:19 -0700 (PDT) MIME-Version: 1.0 References: <20210824112946.9324-1-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Tue, 31 Aug 2021 20:57:43 +0800 Message-ID: Subject: Re: [PATCH v3 0/7] sched: support schedstats for RT 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 6:08 PM Peter Zijlstra wrote: > > On Tue, Aug 24, 2021 at 11:29:39AM +0000, Yafang Shao wrote: > > Hi Ingo, Peter, > > > > This feature is useful to trace the sched details of RT tasks. Hopefully > > you can give some feedback on it. > > > > We want to measure the latency of RT tasks in our production > > environment with schedstats facility, but currently schedstats is only > > supported for fair sched class. In order to support if for other sched > > classes, we should make it independent of fair sched class. The struct > > sched_statistics is the schedular statistics of a task_struct or a > > task_group, both of which are independent of sched class. So we can move > > struct sched_statistics into struct task_struct and struct task_group to > > achieve the goal. > > Do you really want schedstats or do you want the tracepoints? I really want the schedstats, which is very helpful to help us profile thread-level latency. The tracepoints is a bonus. > In general > I really want to cut back on the built-in statistics crud we carry, Pls. don't. There are really use cases of statistics. Our use case as follows, Userspace Code Scope Profiler { user_func_abc(); <---- uprobe_begin() get the start statistics ... user_func_xyz(); <---- uprobe_end() get the end statistics } Then with this profiler we can easily get what happened in this scope and why its latency was great: scope_latency = Wait + Sleep + Blocked [1] + Run (stime + utime) If there is no schedstats, we have to trace the heavy sched::sched_switch. [1]. With patch #5 and don't include sum_block_runtime in sum_sleep_runtime > there's too much and it seems to keep growing forever :-( > > (as is the case here, you're extending it as well) > > That said; making schedstats cover the other classes can be seen as > fixing an inconsistency, but then you forgot deadline. > There's no deadline task on our server, so I didn't support it for deadline. But with this patchset, it is very easy to extend it to deadline and any other sched classes. > > After the patchset, schestats are orgnized as follows, > > struct task_struct { > > ... > > struct sched_statistics statistics; > > ... > > struct sched_entity *se; > > struct sched_rt_entity *rt; > > ... > > }; > > > > struct task_group { |---> stats[0] : of CPU0 > > ... | > > struct sched_statistics **stats; --|---> stats[1] : of CPU1 > > ... | > > |---> stats[n] : of CPUn > > #ifdef CONFIG_FAIR_GROUP_SCHED > > struct sched_entity **se; > > #endif > > #ifdef CONFIG_RT_GROUP_SCHED > > struct sched_rt_entity **rt_se; > > #endif > > ... > > }; > > Yeah, this seems to give a terrible mess, let me see if I can come up > with anything less horrible. -- Thanks Yafang