From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 604A33D3498 for ; Tue, 20 Jan 2026 11:49:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768909746; cv=none; b=h6dvxk9HEiFaCxwIcKVVRFOR5fYKwEUv1nwvqE1asREkH8NMw/zw+r0KfU8r41cMGeq6OIRuIKYFICE1zkUIrtE0rriyrix5giuIv8YOINFhx9SeloCa+GXYeoJY+uFm0vR2NyJRjW2Git0k4xyvvbXK4Ay/fGAOvdAmIHHup94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768909746; c=relaxed/simple; bh=K/3PqhQrBSRRqWdz/5Np6KmgyTYQR1Q1HrN8Cfyed9w=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lrvJh+9H/kEQL3xxKkRCfqfxFGWUy1c+IEhl+TK47tlDsTrPbUkpnjYwszhRVix6zaYZvopgXzQ26Je5XKBk9OYVwGVwsQirjj6ZT3Sg4MafasSY/El35s9Aeyp6BHXY8DsGlCySLXGahiWHxqMnwKt1uyCpA+dgJWCOmVLwtCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=VrwwJ24A; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VrwwJ24A" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1768909742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+QGeqFOnO4/PCW/NTgJWtMtYM5sTX1BsrEAeLk2tgrg=; b=VrwwJ24Av31jn21OJsGXYJEzI3q904XMHRzGbDSKX8VDHkNVOV76T4f/0EbbVkVQveU1mQ xUMkIvHMbXIBng4mfrg2bIKp4aJ8gOmhhBzdfbI/McoZIq/sD0HTX5fGiTV0g9bVLME+zf jn0/OH+yG2MNZB/YYmBzx6xTBZj1VSY= Date: Tue, 20 Jan 2026 19:48:52 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [v6 PATCH 0/2] hung_task: Provide runtime reset interface for hung task detector Content-Language: en-US To: Petr Mladek , Aaron Tomlin Cc: sean@ashe.io, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, akpm@linux-foundation.org, joel.granados@kernel.org, mhiramat@kernel.org References: <20260115023229.3028462-1-atomlin@atomlin.com> <3783efcc-f5f3-433d-a812-dc95030c87f1@linux.dev> <446y53ztmkyw5pqp6klxwd74cvwbjoptzezurr6qxg46frieg3@mbwmglq2qth5> <0b4a76d3-9dcc-450c-9902-dc37b84eb2cb@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/1/20 17:46, Petr Mladek wrote: > 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. +1 Thanks, Lance > > > 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