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 ED3F3C4332F for ; Fri, 21 Oct 2022 00:58:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A3AC8E0002; Thu, 20 Oct 2022 20:58:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 153E18E0001; Thu, 20 Oct 2022 20:58:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 042878E0002; Thu, 20 Oct 2022 20:58:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E82638E0001 for ; Thu, 20 Oct 2022 20:58:27 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id BD3EB401A9 for ; Fri, 21 Oct 2022 00:58:27 +0000 (UTC) X-FDA: 80043145854.05.758052C Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf25.hostedemail.com (Postfix) with ESMTP id 3D629A0027 for ; Fri, 21 Oct 2022 00:58:27 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 782D3B8283C; Fri, 21 Oct 2022 00:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 166E8C433C1; Fri, 21 Oct 2022 00:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1666313904; bh=5yLhVCUhBQBePRY5NTY6Rawpef5GL4cx0onubKzHul4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DZDARGIgcLQ6LqDsLARjMxK9nxiMXV5WHH0hBOJJzwWjm3/Al8CwMwv+HAhatnX7q fS1JKZxzuEGDdFYzC2ByKgJyEGA080ILJ7Waxl+hjhMTUmb7/6Zrnk6l2VuJNWE67D 3t+wF0NiXcwjoyrPIE5H6UNEVr+yXQm2SD237KJw= Date: Thu, 20 Oct 2022 17:58:23 -0700 From: Andrew Morton To: Waiman Long Cc: Catalin Marinas , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: Re: [PATCH] mm/kmemleak: Prevent soft lockup in kmemleak_scan()'s object iteration loops Message-Id: <20221020175823.d7aa5cfeefd8673429f42081@linux-foundation.org> In-Reply-To: <20221020175619.366317-1-longman@redhat.com> References: <20221020175619.366317-1-longman@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666313907; a=rsa-sha256; cv=none; b=GL9/vQSDFrC9l3RStH2tEWvCKnggoeiGEQSXlM41Idpe2NAV5X/n/69gqT5smWS0BWP/yc FG8h4pslJXFZii/cDhQu2QfbyXmm5PcULQxRURHCQenA6+nRnwj49AcVA+ojTEBiQPLeMQ KCWMb78E3fSGr3VlZ09VRSl92WK2DeE= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=DZDARGIg; spf=pass (imf25.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666313907; 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=k1JOtaOwit3RThqn5+yoeckyMOxnET87YmzzLhBFga0=; b=Jxhb7t956kXsGan3CW8p+CBXVH5bomB2j1k3ZTzvcFR8HEHG7bu2EIf2DMfr/lZ6YXh33C Qhvw8KsEyeQs1xu7m63q4ptfSnfSfHiE3SQXqV26BOTd3gPo+KYMsYpdQI+ksK0xLhf/HO xDgD3BU/EYwAPgS3QiXFxPDddMPUt7M= X-Stat-Signature: 99hbqnuzybodydk1uqxezqkpbfq5my7s X-Rspamd-Queue-Id: 3D629A0027 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=DZDARGIg; spf=pass (imf25.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1666313907-758512 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: On Thu, 20 Oct 2022 13:56:19 -0400 Waiman Long wrote: > Commit 6edda04ccc7c ("mm/kmemleak: prevent soft lockup in first object > iteration loop of kmemleak_scan()") adds cond_resched() in the first > object iteration loop of kmemleak_scan(). However, it turns that the > 2nd objection iteration loop can still cause soft lockup to happen in > some cases. So add a cond_resched() call in the 2nd and 3rd loops as > well to prevent that and for completeness. > Seems reasonable, although not an object of beauty. We didn't include a Fixes: or cc:stable in 6edda04ccc7c, even though it addresses softlockups. I think I'll add a cc:stable to this, with a Fixes:6edda04ccc7c. So any kenrel which included 6edda04ccc7c will hopefully add this as well.