From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BD6AC021AA for ; Wed, 19 Feb 2025 22:56:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0CB3B280277; Wed, 19 Feb 2025 17:56:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 05315280276; Wed, 19 Feb 2025 17:56:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5D2C280277; Wed, 19 Feb 2025 17:56:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C71A8280276 for ; Wed, 19 Feb 2025 17:56:48 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 59299C039D for ; Wed, 19 Feb 2025 22:56:48 +0000 (UTC) X-FDA: 83138205696.02.E3CDC9F Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf30.hostedemail.com (Postfix) with ESMTP id 5719680005 for ; Wed, 19 Feb 2025 22:56:46 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CbJIMMzA; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of mhiramat@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=mhiramat@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740005806; a=rsa-sha256; cv=none; b=EcYSLKEUMRaVwvmDH/Z8iLVRIkqawb+TlaH8pi//eG3e0nWVozk0m5MXjwUmvJ3kDqrmO+ hKns1iLf0MjteK8lYm+Mz3I2J3vixBbohJSjh3LXzAuFn42ONJZz9edghhcsVyH1gEgHmr fToKL4r8sFuZ6V12qs0muvRPOX69xIA= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=CbJIMMzA; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf30.hostedemail.com: domain of mhiramat@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=mhiramat@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740005806; h=from:from:sender: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:dkim-signature; bh=cMxHbdoOrCJRMJk4E7yOfGuDQ7PCMqUoXs3CEwvklf8=; b=1r/ENmfZuxnugJ4Jp8qVFHqBI1FT6jFo2rkRnpv2D7cx+OyCBwsXJ16OoC6NiqvzThuMlM kWgQ+gNjRgVVxhkOcXHKNVATG8HgTD2JlRjnLIaQZ31vbtF6BGAkHcv+TTYvsoHIe0THKI xlYJzSXqKUTZwtwuNz8ZpN7uOEXM98A= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 07869611F3; Wed, 19 Feb 2025 22:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62E6FC4CED1; Wed, 19 Feb 2025 22:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740005805; bh=9+dCkrzDahzj3n/nd8JKW8rfXG8Sz4C12rCQ3S9pCFM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CbJIMMzAGd+v10VrUFoSmfCEYyYyCdkJ4wMnu+jURmNerNPdsYr8lLEGTQB8zzp4X Cpo+7fZLEngEOC1TdB1JnL5Lnnt5xB7rSEu6C+I9amEpHLeXx1FHnNwi7qgZXJx1Gt KLR9tn1q7bmM2iZvms0ZuBKCjmlozGyYmuGcH5kOmO0uumJd1yVnDvQzkSf6OLybpl pw0biRmwkrpWsROWybWbdqILsVkJ2MNSkDhSHHIRf+zCeI5xqJ04YGDOI0tTxuPY01 AL6UMRff9NiRWBlhk/hLbKsMA3R3I9E1/Vn6vdNd4bAhaIcDe1Ap0W5y8AN8s3RgNi mt88lCNKwFYUA== Date: Thu, 20 Feb 2025 07:56:39 +0900 From: Masami Hiramatsu (Google) To: Waiman Long Cc: Steven Rostedt , "Masami Hiramatsu (Google)" , Peter Zijlstra , Ingo Molnar , Will Deacon , Andrew Morton , Boqun Feng , Joel Granados , Anna Schumaker , Lance Yang , Kent Overstreet , Yongliang Gao , Tomasz Figa , Sergey Senozhatsky , linux-kernel@vger.kernel.org, Linux Memory Management List Subject: Re: [PATCH 1/2] hung_task: Show the blocker task if the task is hung on mutex Message-Id: <20250220075639.298616eb494248d390417977@kernel.org> In-Reply-To: References: <173997003868.2137198.9462617208992136056.stgit@mhiramat.tok.corp.google.com> <173997004932.2137198.7959507113210521328.stgit@mhiramat.tok.corp.google.com> <20250219112308.5d905680@gandalf.local.home> <0fa9dd8e-2d83-487e-bfb1-1f5d20cd9fe6@redhat.com> <20250219152435.35077ac3@gandalf.local.home> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Queue-Id: 5719680005 X-Rspamd-Server: rspam12 X-Stat-Signature: gqgaioauyynyfh1ihost61yka8k1zjw8 X-HE-Tag: 1740005806-196308 X-HE-Meta: U2FsdGVkX1/qqFI1trADu0YqEfsySAkGzcgWjcR4Xu99Y9DvgB+aExV1Uo7uohN0xQRpC+t0WPGnOpUfD6s9Dvs1WsUnZgwq+1hPIIbcqaqwCl5FBIdg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zose+BgwqgivcaAUARaVaC+5MGD87DzYRaC0zrVZsrMM6M0mlUzwcpoXUNRlu6cQ1Zm/iTDof3z1N0gpr50GZO+vkZH3inFueW5hoOIvPsCsIEC8gDzKgUlTIm18GNnzw8Ru9V1p2PJKR6G+KVTVzSJhgcqoAk3cL05JI3WTvkd/6X+aCaoSq7RnVfIuciAesJA0xCuJK4X+Jb2QWH6CqfzfNhrRWubaprMttdH X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, 19 Feb 2025 17:44:11 -0500 Waiman Long wrote: > > On 2/19/25 3:24 PM, Steven Rostedt wrote: > > On Wed, 19 Feb 2025 15:18:57 -0500 > > Waiman Long wrote: > > > >> It is tricky to access the mutex_waiter structure which is allocated > >> from stack. So another way to work around this issue is to add a new > >> blocked_on_mutex field in task_struct to directly point to relevant > >> mutex. Yes, that increase the size of task_struct by 8 bytes, but it is > >> a pretty large structure anyway. Using READ_ONCE/WRITE_ONCE() to access > > And it's been on my TODO list for some time to try to make that structure > > smaller again :-/ I agree to add the field, actually it was my first prototype :) > > > >> this field, we don't need to take lock, though taking the wait_lock may > >> still be needed to examine other information inside the mutex. Do we need to take it just for accessing owner, which is in an atomic? > > But perhaps if we add a new config option for this feature, we could just > > add the lock that a task is blocked on before it goes to sleep and > > reference that instead. That would be easier than trying to play games > > getting the lock owner from the blocked_on field. > > Yes, it could be a new config option. This will be a useful feature that > I believe most distros will turn it on. Or we may just include that in > the core code without any option. Do we need another option? or just extend DETECT_HUNG_TASK? Thanks, > > BTW, this field can also be shared by other sleeping locks like rwsem > and rt_mutex as a task can only be blocked on one of them. We do need > another type field to identify the type of the blocked lock. > > Cheers, > Longman > > -- Masami Hiramatsu (Google)