Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7649848rdb; Thu, 4 Jan 2024 03:30:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHR8/0aoIsMx9w0PCiAlHI4DCZBnNio+EEgb0xLLvGYNvRfRCUETs2TuVLBIdmd+8HAVMQ+ X-Received: by 2002:a05:620a:2052:b0:783:4e3:c992 with SMTP id d18-20020a05620a205200b0078304e3c992mr110545qka.0.1704367801123; Thu, 04 Jan 2024 03:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704367801; cv=none; d=google.com; s=arc-20160816; b=DaGOb/6GKCwT7SbjthSrYU/B9wH1knb+8c3/n678TabXyA/p1LJkxeMX806WJCR9vF r8UBannrqbPValYq57kmFs+5NKAhn4fFdVyLaHKk0luJgj3ks3McrjKHvaB8bUsCBjFS 9LUkMuOF8pi1sGYb6LWWOjdUOIvgdkSCWQrz9ShnoNGK+6QotHc+4GbKoRw5TJqilUDi ypH5b3V0TQtQK3adhgz9SSkfFi2yHvXhSaPtxDsiV6dc+uVCWtsMvJ4te3AKmeB5XQcR MhZgRJfeTZGPswUmnSW0i4gIVoy9PcdwYRDBuajkh61HGMZnrHQ2OIeYbuWqWl4Kh88/ DqNw== 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=Mal6k+RmsnZAWWsIjGD0I1QkVmbv9FereFIDnUdqh6U=; fh=u1aY8rpDT9x4SzckIhHCOIDWYncMsChZAd6zZjCYbe4=; b=CKtbwgy9x819tpsH0BAinGq1heVJwyq7ALTn5rIem3VegHxbV1R1PbXBxrZzYBzzKr PUNAa93AF7B2l1wXrqoVlL/onXGGFWyJfZ4hA7AskD+rLNJAT9ZNzye8ZkpPtsLMDo2d isb+b7QznNpIB4MHK3NXNM9oM0L50m7mazc7qlspZ+pJID8wIL5cyPWUund0ZglOGGFp ofYUzQJzpqk+7Nrjd1S7b+MsErqIeMbzhYpJIWGt8qWepH/2KwdVVW5dWaZESngkEss4 k+vnyhVQyn2XwPoSaoz+B/RKsAtjCreIHlSb6ZgRfNM78Swt7ssEBf2y8BV8cshbWpR+ CBwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HO2LdRv9; spf=pass (google.com: domain of linux-kernel+bounces-16586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16586-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 k19-20020a05620a07f300b0078110391418si30182807qkk.776.2024.01.04.03.30.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 03:30:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16586-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=HO2LdRv9; spf=pass (google.com: domain of linux-kernel+bounces-16586-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16586-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 7E2A71C23FD4 for ; Thu, 4 Jan 2024 11:29:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B9BB2135D; Thu, 4 Jan 2024 11:29:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HO2LdRv9" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (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 13FF72134E for ; Thu, 4 Jan 2024 11:29:40 +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-ej1-f44.google.com with SMTP id a640c23a62f3a-a28b1095064so47473366b.2 for ; Thu, 04 Jan 2024 03:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704367779; x=1704972579; 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=Mal6k+RmsnZAWWsIjGD0I1QkVmbv9FereFIDnUdqh6U=; b=HO2LdRv9aElnfd4iFBjsijKO6z6u4N2iwBFxUVAPeGlXTeUcXMCTuBXMtMd5C+J7uo YDvqYtslRqOMdoYVtV/ouTKSe5UFdowwkEhimOpUoai+pvb7jHJqUR1pgi8hf8TVC3sC Xve/sxzuymVs8pwVwiK09J4ZVk62pImpGAPbbEywheJcQvIqRIF5CMcE56xPSEDBPuXM cLEjhnkhPk8RxvpzOUUbWOU4binh3ulEspU2zKPHvP36LMytAWBgOoSrfyNnsmPfOBKD k3F32QZoC+oHGIVB+gohoBIlewmGMvfDiHqZ+qwBft4NEV+irLXS3Up6+9Bebz/9+F2e MNFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704367779; x=1704972579; 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=Mal6k+RmsnZAWWsIjGD0I1QkVmbv9FereFIDnUdqh6U=; b=fq8fEAQdmINJkXZAkbyc0ZgAzBsWZaMDxD/WPwI+OOxRn93YzzNaS6zupo4RSlLw72 b6poO5pmVusuOxqHMp29vrSjvXadbhxvGdba/kzs/GZjcriwrhryBbqm58bXosbUIlIF +Qj0G6dG+O5gvxeRFqEqdfKyvY4/bdlUD9cX9AeXgOA5P8SCQNc3MbfgFYscjk632D16 1OGKgYgalz62ssRJG16oF4QHsw5PaX3jjdT/3n/H9SrCzIMw0YU3usrlaJOFrV8zUC/0 FTGmQ6h/2u079nHGi+FCE6HGfQMhtHTtR/LmKPT5lCTpJbCh75DwMDUeP5x76pTCsLvQ zc3g== X-Gm-Message-State: AOJu0YwrzbOREnQsVvximkCzXnoPH+X8fb3auh1L6UdO7C19QXy9/Hj7 PN22lSsuAvIY7N8vkKc7FSRljkUaKMgPsFdSVkQ= X-Received: by 2002:a17:907:807:b0:a28:6611:513c with SMTP id wv7-20020a170907080700b00a286611513cmr218111ejb.141.1704367778992; Thu, 04 Jan 2024 03:29:38 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240103081042.1549189-1-alexs@kernel.org> In-Reply-To: From: Alex Shi Date: Thu, 4 Jan 2024 19:29:02 +0800 Message-ID: Subject: Re: [PATCH v2] sched/stat: correct the task blocking state To: Valentin Schneider Cc: alexs@kernel.org, Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org, curuwang@tencent.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Jan 4, 2024 at 6:38=E2=80=AFPM Valentin Schneider wrote: > > On 03/01/24 16:10, alexs@kernel.org wrote: > > From: Alex Shi > > > > The commit 80ed87c8a9ca ("sched/wait: Introduce TASK_NOLOAD and TASK_ID= LE") > > stopped the idle kthreads from contributing to the load average. Howeve= r, > > the idle state time still contributes to the blocked state time instead= of > > the sleep time. As a result, we cannot determine if a task is stopped d= ue > > to some reasons or if it is idle by its own initiative. > > > > Distinguishing between these two states would make the system state cle= arer > > and provide us with an opportunity to use the 'D' state of a task as an > > indicator of latency issues. > > > > get_task_state() already reports TASK_IDLE as 'I', which should be what > userspace sees (e.g. via /proc/$pid/stat). This is also the case for the > sched_switch and sched_wakeup trace events. > > I assume what you mean here is you first turn to schedstats to check > whether there is any abnormal amount of blocking, and then if there is an= y > you turn to tracing, in which case you'd like the schedstats to not make > things look worse than they really are? Yes, switch/wakeup or others could help to figure out real blocked time, but with this change, schedstats could give a neat and elegant way. Thanks! >