From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 95ABD3D6661 for ; Tue, 20 Jan 2026 09:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768902381; cv=none; b=rMIo+AILcElT0w5REvb4dc714Q+Kd6PD+pvbomQ5ENgL64+FNwa1qhhL7nM3VTZIeL8/MvoBDQXRyBdQB699EK27YFe1+PJLdlG87dNfO2hYCwLGuu2swbAVbpP+bpWX5mWf36RKzq7GwB9qdLOsdetbMwRNkvIXUqZ7E87eSjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768902381; c=relaxed/simple; bh=4qmr/2VYlJTNtOkJIOX298h6XekyWmabR85E7HgXWJg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lil2YIrKawa6JLQ3doYZ6P7jmoUNEOZHdwQzLHHM6v1eP+x5biELFsQafM8H8Fjn1qSmifIafrZrl6TIOA3WmTvDl16icE9HsN6ADdKlPJNrvsE4HBbiF4z+SBJIXxgVti1tzGPvyHcfuUeOZed2CNQhhZa0/C1WCFYAr4eGi5k= 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=J0HxlgiT; arc=none smtp.client-ip=209.85.221.43 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="J0HxlgiT" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43284ed32a0so2840148f8f.3 for ; Tue, 20 Jan 2026 01:46:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1768902377; x=1769507177; 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=bmABiODD90YY83tykPokTjbkcyofmkDeo1sqH545+H4=; b=J0HxlgiTXL0EhWTrLE6WJgEySwe3K7VwwTJ5Q7vGCD4vJ4Z5x/VrPs7oSj/UeVQzzi wFDqbDm80eVTZrdSQfY/TUlrkxHGgq6dKCUxG46RxuRuSVyDyY9MfXFLzeVx3QT+nYKu XJ0UwGvQeHc8FSoJiX9in2VoM2wuka1BbZC8ODynA+NItk2jaqMBzovEe//faFtRyQ2i pY4Se2GIC1azbEFkyDn7wSp1LRyERP2rOtIHVv6Oyf0/02I8MRT/M27AY5Cy7vT0CMsj 895AfJxFhL76tsBfcKlZxBnD9wD3xEltV/uNpynxztKIBUJI1fVXb4VFXPhkKGt5md4O DZeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768902377; x=1769507177; 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=bmABiODD90YY83tykPokTjbkcyofmkDeo1sqH545+H4=; b=bHSarWv+TCFMD7U8jwwRvD+tk9zdpTlQ20QPAyGMAQsiqRkCIsNSWxEzcaIx6Ouw+7 vU9LzqV0/RR52XGjsU9O+FHcQvMtLOTg9pkNHzxplGMtcFfqDB8jSmhoq/D/kyy6WFXd K1xnvx7RDuNT6L7NiB1x0C3t9+PDNxdwK7SXXXfK4pgS8QeGQ2/mIR8yUDVhWnaUARQ2 Zug+07ZR+WBtrFWPU1Ei/G9RhT5lznL9GOzaIw0yCOM5hHpIGSU1ZV1eg+HI9R/4iiwI XurvWFDc4tCUukD2w+bosmptxAZZAJDRDF2Z6wCTSNoYOFNv7Srt1iByT7IdHwrTaN5X bOUg== X-Forwarded-Encrypted: i=1; AJvYcCWmilYtw/OwchcjtKluIp+BCjNAfcBj73zcEk4ogZPYYyNq6kKDfFzX0tMgAkElo2UoHUvkNLUA1RCsIJg=@vger.kernel.org X-Gm-Message-State: AOJu0Ywq+HygYDj1E9oRkWrC8b+le6NpZojv0/BCpq34cv0yQBQRJfgl hagJ2+gY8Uag1WdSiDdLlMa/oUILOUV4W885uEpb3GwFRzEOCkhZNy7SbVW7IlsFhUQ= X-Gm-Gg: AZuq6aKGdM2H2lJzP2efQtLW4uB0Fs+SmqruZI5nWNbZ8/PjM/vVgJaEDPKuVuLcqmn 8Dt7ecMV+g0wfmvW1l1yhYucC/ujHyS6Es/RfDDijTUIm6/tBeOL5Ihmpr+R/ixUaDeSdQ4kZRK Kb0Bd/gz+GCnTGndqrxXgLzYj4iI/SCFq9HP/ZYcZrJpMeGPPTktZenL0fp/nBjfZT5gIwhK0Rq +brQyP56Lt0jnhPmV8zgx0EqM2iFPnq2I2P13AGzsnEhxtbOt3qKIphkKno93hVBoWkug176Xhp VYWPPtvq2X1GRLQoRpBU8oNQqFVLoNz/6sXuV+ZzbYly7n4Od4zGxDWuEXAYZMRWkcEdvaUMz2U yJsiPIKWjVZB/35ZjcHtOXuzk/6tW5c2t4DeVgJ31j95GEW9Z1rm4zpz7tyJcf0UoiP+YiwQf0N kn8+gFQ54MuwhvcA== X-Received: by 2002:a5d:5d12:0:b0:431:a38:c306 with SMTP id ffacd0b85a97d-43569bc70f4mr16549480f8f.43.1768902376824; Tue, 20 Jan 2026 01:46:16 -0800 (PST) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4356999824csm28347651f8f.39.2026.01.20.01.46.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Jan 2026 01:46:16 -0800 (PST) Date: Tue, 20 Jan 2026 10:46:14 +0100 From: Petr Mladek To: Lance Yang Cc: Aaron Tomlin , sean@ashe.io, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, joel.granados@kernel.org, mhiramat@kernel.org Subject: Re: [v6 PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector Message-ID: References: <20260115023229.3028462-1-atomlin@atomlin.com> <3783efcc-f5f3-433d-a812-dc95030c87f1@linux.dev> <446y53ztmkyw5pqp6klxwd74cvwbjoptzezurr6qxg46frieg3@mbwmglq2qth5> <0b4a76d3-9dcc-450c-9902-dc37b84eb2cb@linux.dev> 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: <0b4a76d3-9dcc-450c-9902-dc37b84eb2cb@linux.dev> On Fri 2026-01-16 10:22:34, Lance Yang wrote: > > > On 2026/1/16 02:18, Aaron Tomlin wrote: > > On Thu, Jan 15, 2026 at 11:24:13AM +0800, Lance Yang wrote: > > > IIUC, we should just do: > > > - Patch 1: Full cmpxchg-based counting (Petr's POC), sysctl read-only > > > - Patch 2: Add write handler for userspace reset > > > > > > That way Patch 1 is the real logic change, and Patch 2 is just adding > > > the userspace interface. > > > > Hi Lance, > > > > Thank you for your feedback. > > If I am not mistaken, Joel suggested the following structure [1]: > > > > 1. Create a preparatory patch to change the data type to atomic_long_t > > 2. Introduce the required functionality to support a reset to "0" > > > > [1]: https://lore.kernel.org/lkml/d4vx6k7d4tlagesq55yrbma26i2nyt4tpijkme6ckioeyfqfec@txrs27niaj2m/ > > > > Yeah, either way works :) > > But that way (changing to atomic with the old logic first, then > rewriting to the new logic) seems like it creates more churn > and makes review harder. I agree that adding the atomic and keeping the old logic is not good. I would prefer to split it into two patches the following way: 1. Reshufle the code so that "sysctl_hung_task_detect_count" gets incremented in check_hung_uninterruptible_tasks() and hung_task_info() will just get "this_round_count". Plus convert "sysctl_hung_task_detect_count" to atomic. It is the change that I suggested at https://lore.kernel.org/lkml/aWTzhLSWQRIGt8Xu@pathway.suse.cz/ This way, it would be clear why the reshufling was done. And the atomic operations will get the right acquire/release semantic right away. 2. Add support to reset the couter to "0". It should be a quite simple patch easy to review. I think that this is how Joel meant it. We could even have 3 patches: 1. Move "sysctl_hung_task_detect_count" increment to check_hung_uninterruptible_tasks(). 2. Convert the counter to atomic operations. 3. Add reset to "0" support. But I think that two patches might be good enough. Best Regards, Petr