Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1821842rdb; Sun, 24 Dec 2023 03:39:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IE354+PimVH0rMZlW9QVIz6XVd27M+gnRAYqv3TObtRFPoicJr5QMYuwmrxaklBpEbu2L/h X-Received: by 2002:a05:622a:14d0:b0:425:98b8:9a34 with SMTP id u16-20020a05622a14d000b0042598b89a34mr6654618qtx.56.1703417953336; Sun, 24 Dec 2023 03:39:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703417953; cv=none; d=google.com; s=arc-20160816; b=fJGXXHl31mJyqm3QSDe4eNIyBayERfj/MgmPr5nln9rYF+yfdcavNOHao/0QZQeHcd TLuFVII5+j0Frqol16OMXHYNxVm1RXXlM9R+GCymA8kSFvf0FsbmywqIVDbig8mlY0EE Sv4tzYC7pK3rEq2Y6P6FK3Ank+204flJ7O2rXU1vU+UR/z3pVwZb+YvQnqnoL5iMnGkd L5X6lYOHYmv1jJ1HQ5g0fremYzQvLkAVtwX1/NRAEhQs+nEbNM8mlbxbOOeUk6HtxQFi 0YauuBOvj/QtlRHHEun9lgQBmXe+XBIZmxJSEmFdIPiy34QnRHxs09z3iU6NoRgP90uD vfnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=LrP1BOh8R9a54b7OYq/9y4AFoHBEUH9+IlCKTqH8hjA=; fh=cyOSwSkj+iJBVGbt7eJLCz15URs0PAUR1Bwubf+t8Gk=; b=l5wNIKWxWN+vz69YEwxHBWhiVP0AxPqNbA/iffZxvqWl5dt79qEztnzBJCQ04VNbNt v5eI8+rk187PV/nLGBK5faGMZKHt9uignEP4hxm7iBWPg2staa7wWzzBBQh1W6uUkoGx KhNw4IrbkgQmgdfmVs6OENaU6TywV3PExSiBgP7FR/2b5rj33P2GzHJjlxmkgYOztKmG RFD6MW6TJdYqDQwGQZPbSgG4MyVBz0IeaRpmRqi7Hhlt2Q8nNBmcDM/tVtfpVL18lkcf UQMNazcye4KhFqpZ1QmQnGBTwN1LZdtrpSdr6M84vptttsc0nmgxpP+WnfZetHt0I05c La2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DQCa7gAl; spf=pass (google.com: domain of linux-kernel+bounces-10691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10691-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id v11-20020a05622a130b00b004239ad6ecb8si8568026qtk.226.2023.12.24.03.39.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 03:39:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DQCa7gAl; spf=pass (google.com: domain of linux-kernel+bounces-10691-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10691-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E65891C20C76 for ; Sun, 24 Dec 2023 11:39:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A65723AA; Sun, 24 Dec 2023 11:39:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DQCa7gAl" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 606FF20FA for ; Sun, 24 Dec 2023 11:39:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-67f33cf014cso26167926d6.0 for ; Sun, 24 Dec 2023 03:39:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703417942; x=1704022742; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LrP1BOh8R9a54b7OYq/9y4AFoHBEUH9+IlCKTqH8hjA=; b=DQCa7gAl09ZPdBdfRoWzJVNF+BJRq1N0/Eta87hjnrxrbPgeOsWoW48Df3zJwuGqtE MxaZWZD0lxlK9hHWBsIL8LYGcidYIJo5WkKim1Z37ySpcaOMpNnCRBafCTUPiafBMg8X FsrpIS8oztiTyE5LzgSKIOG/p8KKeCl9MlzWy6N0zi7U2a6X6dYvWvhFqNhOTtUN/WS7 kCVoZ6osZ3K4VPD0Q9W3L2qAoiZrgLEpZjKeqDQUxQsZjkOJyC43Wp52yl9zbla1LfY7 UGCtMV0h8h+kCMM5Reqix2ZGbtsjjNK8oSDrmGhjOOsT7lol0K4iTMdU/OHbhge+l1er FKuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703417942; x=1704022742; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LrP1BOh8R9a54b7OYq/9y4AFoHBEUH9+IlCKTqH8hjA=; b=u8ACw1yBYzBe0wJxK86kdWeXVz8CKNiEsPmyOq9ncwwU+K4AWRmcwxPKNh64xxczGb 4AYdJ2MVoTO3nvUcL+6sX8ar2Iq4LvMUy1CNY+6JyuCvcuGjXkKq2A2c5Ly5YcnLUiiM Q3kL79oXgQpPy5BApk2Q4T+FIbMZp4UiHnevBcQg5ncGfZ+2lU0SpNrFWSCR/BXQ7Tsf qoAEhWt1aO3TOPRLbhdk/1rKroNnJSZv5/+aIIED/rAPkSQJCgm5EDwjmlJjWxHCdpcj qRxd+vcdy0aNTiYqeXuEls3moYtEaHwSybPGOTrRkhQHpHOZWjbEyKeHtlXfy5WMJnAM cS0Q== X-Gm-Message-State: AOJu0YxN5g/0ueTrSbEwbV6DBeK1oMymzGbiW+uSEju+WZeDOXeS/M6w Kl1uBmyTum0ueqtDwcKlgueTQ57ERS2fA0NWGVs= X-Received: by 2002:a05:6214:62a:b0:67a:a714:d963 with SMTP id a10-20020a056214062a00b0067aa714d963mr6533435qvx.55.1703417942085; Sun, 24 Dec 2023 03:39:02 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231223053634.942784-1-wudaemon@163.com> In-Reply-To: <20231223053634.942784-1-wudaemon@163.com> From: Yafang Shao Date: Sun, 24 Dec 2023 19:38:25 +0800 Message-ID: Subject: Re: [PATCH v2] sched/rt: Fix rt task's sched latency statistics error in sched_stat_wait trace_point To: Junwen Wu Cc: bristot@redhat.com, bsegall@google.com, dietmar.eggemann@arm.com, juri.lelli@redhat.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, vincent.guittot@linaro.org, vschneid@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Dec 23, 2023 at 1:38=E2=80=AFPM Junwen Wu wrote: > > >It seems DL has the same issue. Pls. also fix it in update_stats_dequeue= _dl(). > >And add the Fixes tag in the commit log: > >Fixes: 57a5c2dafca8 ("sched/rt: Support schedstats for RT sched class") > >Fixes: b5eb4a5f6521 ("sched/dl: Support schedstats for deadline sched cl= ass") > > ok, the PATCH v3 below is ok? > > Subject: [PATCH v3] sched/stats: Fix rt/dl task's sched latency statistic= s > error in sched_stat_wait trace_point > > When enable sched_stat_wait trace_point, some rt tasks sched latency so l= ong, like this, > sched_stat_wait: comm=3Drcu_preempt pid=3D14 delay=3D4936139545261 [ns] > Rt task has low latency, it must have a bug. When rt task balance off sou= rce cpu, > dequeue operation not update the sched_statistics, so follow update_stats= _wait_end_fair > update method, so do dl tasks. > > Fixes: 57a5c2dafca8 ("sched/rt: Support schedstats for RT sched class") > Fixes: b5eb4a5f6521 ("sched/dl: Support schedstats for deadline sched cla= ss") > Signed-off-by: Junwen Wu Acked-by: Yafang Shao > --- > kernel/sched/deadline.c | 8 +++++++- > kernel/sched/rt.c | 7 +++++++ > 2 files changed, 14 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index b28114478b82..29223163ee22 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -1558,10 +1558,16 @@ update_stats_dequeue_dl(struct dl_rq *dl_rq, stru= ct sched_dl_entity *dl_se, > int flags) > { > struct task_struct *p =3D dl_task_of(dl_se); > + struct rq *rq =3D rq_of_dl_rq(dl_rq); > > if (!schedstat_enabled()) > return; > - > + /* > + * Mark the end of the wait period > + * if dequeueing a waiting task. > + */ > + if (p && (p !=3D rq->curr)) > + update_stats_wait_end_dl(dl_rq, dl_se); > if ((flags & DEQUEUE_SLEEP)) { > unsigned int state; > > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 6aaf0a3d6081..6a2600213991 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -1360,12 +1360,19 @@ update_stats_dequeue_rt(struct rt_rq *rt_rq, stru= ct sched_rt_entity *rt_se, > int flags) > { > struct task_struct *p =3D NULL; > + struct rq *rq =3D rq_of_rt_se(rt_se); > > if (!schedstat_enabled()) > return; > > if (rt_entity_is_task(rt_se)) > p =3D rt_task_of(rt_se); > + /* > + * Mark the end of the wait period > + * if dequeueing a waiting task. > + */ > + if (p && (p !=3D rq->curr)) > + update_stats_wait_end_rt(rt_rq, rt_se); > > if ((flags & DEQUEUE_SLEEP) && p) { > unsigned int state; > > -- > Best regards > --=20 Regards Yafang