Received: by 2002:aa6:c429:0:b029:98:93ff:f56f with SMTP id g9csp3407996lkq; Mon, 23 Nov 2020 05:03:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/i31JQPLg56kPmVghRKi7zFDNjkiYa8+Q46QB61xj3W//5l2HRgTKPFUpLgDjnBh57b5r X-Received: by 2002:a50:b224:: with SMTP id o33mr45161588edd.21.1606136627761; Mon, 23 Nov 2020 05:03:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606136627; cv=none; d=google.com; s=arc-20160816; b=GUJEofaLp9dVrInGUfxIbHWUJyK814kCjj8RXrVip97fNG2zr+Ybmoeqp3SdfVgV6s JTR6uaaxWmJMAD7SU9PR3DnEM7gfJFrEXuZHKxZjryAU7vmxqyLrnNgagF7o1o4XNK4N DzCZ4epIPq+sJUp14sAAIH4WDbVXmkGmTr0pfnfj3ok3/W06dIMlPfjpf+F7OdHoHzIv bC1yetuN8GsWXBHEDpBHOVREFEHBWABCeI8w0OkFYPD0PNgdI4DvYNPdmXdAPhqNPlqU VcFHQhccVEF8nquPu4F8N9+yZbW6o52h2RAbc3RkOfFQ9UCNioCwuu+nuab8KM1b1QcT k8LQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=Jd5Mhav9UmazYcFKU1cQG/3qnylePWCgMlUJxAGwt1Q=; b=GkNv990h4vYH+4NICCOkLDTB/ldOMxRWM49xB9cY1fYySrvrd/TwT7k/bj+3VmHc/o UnjJ9SZHV/9b5aZdwDpCpRqhx1OWNoF9INSTIH2QDMI9Z6w0XFRe2ihIfxjeVv4ko1/k VWq1oH3jbdH5zaLGz8rKyG5VK8BlP12h7AONZGN7MtHGFwjh5qE79Wm51HFemEsD1E+i 7ZPBBeW+HDaA5jgDQkmoV0Gj3MxoxoNuIbN4jQebKkKXGxus22QTzu/8pzdy7C4xYL6n EYlv86drUkcDZP7N5VeuJN81LzPPbEwJMLgospkOqC7aKTbNqBm1jXquWFJ+4LKGSuWH wb2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LAuEhlbA; 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 k3si6359462edk.307.2020.11.23.05.03.18; Mon, 23 Nov 2020 05:03:47 -0800 (PST) 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=LAuEhlbA; 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 S2388165AbgKWM7b (ORCPT + 99 others); Mon, 23 Nov 2020 07:59:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729862AbgKWM6j (ORCPT ); Mon, 23 Nov 2020 07:58:39 -0500 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60564C0613CF; Mon, 23 Nov 2020 04:58:37 -0800 (PST) Received: by mail-vs1-xe42.google.com with SMTP id m16so9048826vsl.8; Mon, 23 Nov 2020 04:58:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jd5Mhav9UmazYcFKU1cQG/3qnylePWCgMlUJxAGwt1Q=; b=LAuEhlbAE9tFO6A6KYvZBVgoZiwn31I5kvLsReYwSoLo6bmInj1PEGe4Ht9uu8HrG8 6k9ZTME2RxPvYflUoPslsgEHSU7eYjfk5Uv4j1hq4LMRr9tMO9epE92gswool2MJ/WSS +dlooA1Fp+qITHZAKIhH5AI749qcy4IZmM6pPF41mvxH/1rtm9P1QZ9qbxRKc55gk0AM StcQH9fJVS5R6gbcFBTGKKaEkST/RWTVGdopLOhPGv5VGyl0VCaLy2W7W8bRwoVE8W0v DIREimQ84cpihNDv9IjgxvHi6rtMbbPesfDLMhqRXOIuOWFGVkE4oG/qrRU2rzIRWjNr OBBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Jd5Mhav9UmazYcFKU1cQG/3qnylePWCgMlUJxAGwt1Q=; b=WJ/USKWaw5HkZRvbQrXu5fSIx0AQlxFKKumatzu6jlCQLpPlU32kIjN2w7XJMFhZ/l JQV4Dzsxnu22KqMz/mCDIpercLq7wEufxp88Q6BclEgrVmDy6f9JEHRs/5yM7d38bf44 WdVDg9sKl/7CZo/7WDvBgUCCZwUVBfvQltJoTieD1riyi9JGJNSFkkEsJK6y6hquD4U6 CWDm9H0CYbKzuzWaI7zrfbxTPB3Kff8D2USs17iPuYLwXq4D20v5uTKWiIMexUuRmI6F Ewf/brDXv89cj9XcfwUmqBGcu8XSOH8JlkcMz+hPfdOwn/lpJQs876XLIB/nLr82DZwt O1Mg== X-Gm-Message-State: AOAM532ocTTIJ84GFTlyvUxmWA1z1BtnMwJMo35iuc7+dGREEELw9AmR 7waNXnJdLEd6BuSogjocATs= X-Received: by 2002:a05:6102:73a:: with SMTP id u26mr17985938vsg.18.1606136316551; Mon, 23 Nov 2020 04:58:36 -0800 (PST) Received: from localhost.localdomain ([50.236.19.102]) by smtp.gmail.com with ESMTPSA id h16sm1579091uaw.7.2020.11.23.04.58.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Nov 2020 04:58:35 -0800 (PST) From: Yafang Shao To: mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Yafang Shao Subject: [RFC PATCH v2 0/5] sched: support schedstat for RT sched class Date: Mon, 23 Nov 2020 20:58:03 +0800 Message-Id: <20201123125808.50896-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to measure the latency of RT tasks in our production environment with schedstat facility, but currently schedstat is only supported for fair sched class. This patchset enable it for RT sched class as well. The schedstat statistics are defined in struct sched_entity, which is a member of struct task_struct, so we can resue it for RT sched class. The schedstat usage in RT sched class is similar with fair sched class, for example, fair RT enqueue update_stats_enqueue_fair update_stats_enqueue_rt dequeue update_stats_dequeue_fair update_stats_dequeue_rt put_prev_task update_stats_wait_start update_stats_wait_start set_next_task update_stats_wait_end update_stats_wait_end show /proc/[pid]/sched /proc/[pid]/sched The sched:sched_stats_* tracepoints can be used to trace RT tasks as well after that patchset. PATCH #1 ~ #4 are the preparation of PATCH #5. - v2: keep the schedstats functions inline, per Mel. Yafang Shao (5): sched: don't include stats.h in sched.h sched: define task_of() as a common helper sched: make schedstats helper independent of cfs_rq sched: define update_stats_curr_start() as a common helper sched, rt: support schedstat for RT sched class kernel/sched/core.c | 1 + kernel/sched/deadline.c | 1 + kernel/sched/debug.c | 1 + kernel/sched/fair.c | 174 ++------------------------------------- kernel/sched/idle.c | 1 + kernel/sched/rt.c | 94 ++++++++++++++++++++- kernel/sched/sched.h | 30 ++++++- kernel/sched/stats.c | 1 + kernel/sched/stats.h | 146 ++++++++++++++++++++++++++++++++ kernel/sched/stop_task.c | 1 + 10 files changed, 280 insertions(+), 170 deletions(-) -- 2.18.4