From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 04DCB35EDC9 for ; Mon, 2 Feb 2026 13:55:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770040547; cv=none; b=nSEqejyXWTWi9eRxoL9qlrZ6sgKYZi2d3MR0Rl2di97cAhTATH5UB0OlUHOGgx0XwrOJXQaLaMqU02FlrK+QieHSdIQeErCX6NztHgAJrDuPNpzZKG6zexIrM3oV5AwNSXq6L+1ZHQRLH8BAK6MySJ04RyoWklp27Wp6KfBDypk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770040547; c=relaxed/simple; bh=ZtRDIGuWPAKicyrI9Kdj1TS1fFU1CTxdOD17oJ5znkk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K/p1bm7WI7mGu3pGQhnoyRcXOt1ziFsbaOU8cPOd51X7/Du5QdYMylt52ZZLtBIDMDBLbSyNqV0Ecf2Wdyhh6ksKn6L0ptD639K1j0QhPAH/HLwT2gKbVG0/ZjDEfxue9RQ9imhOeHpefnV2DPbkkE2fXsckZtv2qQ90BexpjP8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=E3QrZwSn; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="E3QrZwSn" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4806f9e61f9so22825215e9.1 for ; Mon, 02 Feb 2026 05:55:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1770040544; x=1770645344; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=cntk+kuzc5eiX0XVSv+7nQpvspqOBU/YeoKWgECEM/k=; b=E3QrZwSn3axI7HFZYX+7jylM6nq2Yuo6b9V/hEObYUMfgf2/27g+LkT9BRdHNqjSRW ASUVt87jeGI+8248DftgOjngrkIZUgs5uCwZHDzoLq6c3jAiOwNN+Yc1TUZLhdPyiOSh SbnwIigFPEeFn2V3uj7VbFz/UHfnD4PmNTa7vH4J7sQa0l5vzDkbThvokqWCgwLUlw8Q 4hqnwUzwG880BQRd4VorHilNc4+ddoi27xNmu3VTwbjZeJ7psRqfzIlFG2YtsPS3QObU 3p6htNHuTO/0oXuSQv6uRB09H7UNdGlkPKU5gxHIqsyWq7vi/JARrtSHGiAFsnc+gRmL FF3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770040544; x=1770645344; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cntk+kuzc5eiX0XVSv+7nQpvspqOBU/YeoKWgECEM/k=; b=EYSXtzZxE6ELLIpb1k3p6NXJKe8q1n6U6DSijNs4iuW0oIxj5z997GKJku7UMLx4GM WpnY3FX/Uw71ffImuRmMz7MDpAKQzYOXCzi3sc90z2uF8U91GIihavLN4itloMqbJuWJ k5fE2S2To4lvRxC6KeRYEVKGh4sUEuiNNGeo+hkqiNN01wF2wTGVrjfVnYmPcSAGKLko H6ErHEhwNemR9fKh77fWerO5Qz4CM/qT3ZNHgeUJNruB6VPXo3bMqz5DTsNONPq26Lo1 MBSyNIJDda2DeckNTckhrr6JFVRWsLyD7yndCKrLDpY0j1aXTR3Yj4j3izVj95nmq0ai jhkQ== X-Forwarded-Encrypted: i=1; AJvYcCVPW9Q6Ek5U3PGCevd4SQGV57Or1niFc/bDUZ40xwdPFKjtSq57E4p/TiZeiwHLz+fRcGqoAOmygwPWMMo=@vger.kernel.org X-Gm-Message-State: AOJu0Ywk6Q0vBzwgba18KPCM9MRjak+HNDHCttw3GwCXLbRQMw3tSR1h g15ID8ZnBRMgkKbDtdXYvxCIBZqRQl2KocjaTwDhfH5FcD2ZixT+wF2LJupuBCwJgC05/79OvVS h9UzU X-Gm-Gg: AZuq6aKtcklRieoeqQe8hVUCFFrQlrGVg+dvyQW89TD3XSF+qZho3/rah2Wrf1GQIl7 2FPGCQ/rMEuszkMBVwYxf/vSVzjcAPODdSa0IIJ3H6bPIid21EGY1GfRGxmCs/pHQdrlMP3VRpn CT66jqZLaiPLacnnbTc58sNzd1Gckfxtf/qaiBlLwDYKoTTcj9WDi0et6StkzsxtOWpNpOVz8vK 54zTURXq3HGLJn1HvDYMlMxaFmX4dYeVfuMHNk5Xb/jnrYzwmVTYitabruhVNnUdXvFYl8+unt9 7OKM3OFY2cSJgTi0lMF3JloSw6keZjgr18Y4eiQy8oO8ouwUTODcmgZoFT4YexZEiOgLsReELbT zx1s0UUmUGeX0vrGm1ijDKEPULj+8bYPO+QkzNP6ud9pNrQ4uhqjC7iLZ9nNIGTasoGDMtUuasZ KMovDO1qJGiu0dFGtxHQ== X-Received: by 2002:a05:600c:8b0a:b0:477:b48d:ba7a with SMTP id 5b1f17b1804b1-482db495b79mr152036525e9.32.1770040544383; Mon, 02 Feb 2026 05:55:44 -0800 (PST) Received: from pathway (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4806cd8fadfsm406901215e9.0.2026.02.02.05.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 05:55:44 -0800 (PST) Date: Mon, 2 Feb 2026 14:55:41 +0100 From: Petr Mladek To: Aaron Tomlin Cc: Lance Yang , neelx@suse.com, sean@ashe.io, mhiramat@kernel.org, akpm@linux-foundation.org, joel.granados@kernel.org, mproche@gmail.com, chjohnst@gmail.com, nick.lange@gmail.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] hung_task: Skip scan on idle systems Message-ID: References: <20260126034539.3407903-1-atomlin@atomlin.com> <4db98cdc-132b-4034-a6f1-25a3df6d0d01@linux.dev> <3pafybrou47nar5l2xxqjvmbhupmsxr4vvawhdadd5qeyhu3sf@mmugthbxe2cs> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3pafybrou47nar5l2xxqjvmbhupmsxr4vvawhdadd5qeyhu3sf@mmugthbxe2cs> On Mon 2026-01-26 15:14:27, Aaron Tomlin wrote: > On Mon, Jan 26, 2026 at 01:23:01PM +0800, Lance Yang wrote: > > Hi Aaron, > > Hi Lance, > > > Keep one patch or series under review at a time, especially in the > > same subsystem ... +1 :-) > Understood. That's fair. > > > > @@ -503,6 +504,7 @@ static int watchdog(void *dummy) > > > for ( ; ; ) { > > > unsigned long timeout = sysctl_hung_task_timeout_secs; > > > unsigned long interval = sysctl_hung_task_check_interval_secs; > > > + unsigned long load[3]; > > > long t; > > > if (interval == 0) > > > @@ -511,8 +513,12 @@ static int watchdog(void *dummy) > > > t = hung_timeout_jiffies(hung_last_checked, interval); > > > if (t <= 0) { > > > if (!atomic_xchg(&reset_hung_task, 0) && > > > - !hung_detector_suspended) > > > - check_hung_uninterruptible_tasks(timeout); > > > + !hung_detector_suspended) { > > > + /* Check 1-min load to detect idle system */ > > > + get_avenrun(load, 0, 0); > > > + if (load[0] > 0) > > > + check_hung_uninterruptible_tasks(timeout); > > > > The optimization is not worth the trouble. > > > > I don't think the assumption that "load[0] == 0 means no hung tasks" is > > 100% correct. > > > > So that would miss actual hung tasks - a false negative, which is worse > > than the "wasted scan" you're trying to avoid. > > > > Also, I don't *really* care about optimizing something that runs once > > every 120 seconds :) > > > > Nacked-by: Lance Yang > > Yes, please ignore. This is indeed wrong. > > Regarding the value of the optimisation, while a 120-second interval > implies a low frequency, the cost of the scan is O(N). On large servers > with high thread counts (even if idle), iterating the entire task list > dirties cache lines and consumes memory bandwidth unnecessarily. > > Nevertheless, we currently do not have a way to economically compute the > total number of tasks in TASK_UNINTERRUPTIBLE state. It makes some sense. And the check of the average load is trivial so it might be acceptable. But I somehow doubt that it works. Have you ever seen a system with (avenrun[0] == 0)? IMHO, it might be pretty hard to achieve it. Or maybe I am too pessimistic. Or are there embedded systems which can only be waken by some interrupt from a sensor? Do embedded systems run hung task detector? By other words. Is this patch solving a theoretical scenario? Did you test it in practice, please? Best Regards, Petr