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 C6A18C4167B for ; Wed, 6 Dec 2023 11:31:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A7E76B009D; Wed, 6 Dec 2023 06:31:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 558856B00AB; Wed, 6 Dec 2023 06:31:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4475C6B00AE; Wed, 6 Dec 2023 06:31:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3569C6B009D for ; Wed, 6 Dec 2023 06:31:25 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 00E028017B for ; Wed, 6 Dec 2023 11:31:24 +0000 (UTC) X-FDA: 81536177688.01.F2E1C19 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf30.hostedemail.com (Postfix) with ESMTP id DF04580015 for ; Wed, 6 Dec 2023 11:31:22 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701862283; a=rsa-sha256; cv=none; b=l+DmDhfF+YoL6kP9xNaY51Wg/twAqoAWOMBdfHVQnzhA1FFY3hWeRWDnfpXesSuZQHV5iQ ePcqAwo7XVFszlGc2AdGL5NFxyVsHqRv4kYH2lbKGm72XcvYhk3je1jNKu0mWZ4E4oH6H/ 0/QbajIpeet/AO9YiUggzFgQ0yYuk7A= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of cmarinas@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701862283; 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: in-reply-to:in-reply-to:references:references; bh=R0cYwSi/es2Ew3j4iWADhi969rVZBOPlMqaknlbKEvQ=; b=BarzzfJLfhLXG9drsTaZzX/PKg9HpRS58/VPVX8uDemfGF/cPb0b1FozvjPDTxPDlU77RW kiBWPT/sn8lHTexayCTI/T2F/5pJB0aaBzo+GDVn+Gwquvr6kztFlZBCJ2oBQDqDMZImTn 0WLHhGKNX9eqJxVwHmB7FhhW76M2I7Q= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 7DADCCE1D4F; Wed, 6 Dec 2023 11:31:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD8A5C433C7; Wed, 6 Dec 2023 11:31:16 +0000 (UTC) Date: Wed, 6 Dec 2023 11:31:14 +0000 From: Catalin Marinas To: Waiman Long Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton Subject: Re: [PATCH] kmemleak: Avoid RCU stalls when freeing metadata for per-CPU pointers Message-ID: References: <20231201190829.825856-1-catalin.marinas@arm.com> <597352bb-6afa-4fa4-a5ee-1f0aa14e61be@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <597352bb-6afa-4fa4-a5ee-1f0aa14e61be@redhat.com> X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DF04580015 X-Stat-Signature: bpohsp3cteadn87ncc5ubq4nyxegzkh3 X-HE-Tag: 1701862282-814226 X-HE-Meta: U2FsdGVkX18O3G3XnkYxL5IiDfyC2ojxf7wlhsiH147zO8rLk7FVHInfj7D5OweeeiQP6vZouli4RTRa+udmenWlFUgrjb45hX9Ix3ohzxDH10NDd+yULHlak9jW30/KeZ98Hwl8yxB2MSsMJDE/W7bS2EY9I3aI7KM7OltrKeFyN8szD51sLteg6tMRAND3aYPEUalFymqOcQXQUcWuaSGrXo655X8N26f8U6QHAGCj8Z8eEuZXkx+LdloMCpUiGWhGHVz70vnlY94IaOoKuA13c1Bxd8v5AXvkFmjKMblTfFrxfey2COB91Eph4hrB++DPsP969gdKkcq8pM2/uRw1EfaM/58qq8uj8D/zNLI4k+U8SIVvyAIQJvryMZgxf2fOPgippfEP/lntj/mQbVdi6irjvJo92dqVEoGlgFRnZL9zNaK5whThWZLuxFuSVSxPMi0Tfeft8IcBxxjpQ594gVoId68aYrF5Ag6qxWnLKZOBOiJ8wmcwA91l/7A1tDqDkoYYiGQxXi9EgDN3hBwyLyfm4pO3uhYuI0KsIjgQa50IyPLSgs89OU1qPFwLFDwp1m/FSWp45YNpjBfGHaqeRhHYZXmBq/6jQd0ANoBjB6BILLl+6nWZ3af7Cd9CtHCPdwlGgC788RYz5vjZvDGMiTx58oLuo8+yuwgz1/jWVYJZHy3sk1PwE/lFlof4Pv959CKTK0Wbq85y8Zmr6i0AGlVuCkZ77Tx5ooV618JWkMae70IZynftVbyxMeAYH8AHCdn81p8840cVLucG3FRfw+zy6jC04iWSQCLz2foI5tSP8KUTGyZHe+bCp8iDQG/w+C1at0zRZGiMP+iKO2ch4RBGRXI4n0f/beoPGGD6n2U62G9dpEZiB3MqLZx+HJNSlEiS1Mk3Qtt32vYFzLEyFcpY6tkLdl2XpiBy/VSOmOROJt41m2UVFMS0lRz1KitE8aHACYiEKCfAGD5 Mu+kBL/N KPr6Te8atIVogKDCTfcS3nxc2O401lUuPVIY3XbiwfbUFcqYLShndvk3xuPbiJH1eenIY5HfPNMWqkc5tG5uOel0DPB3OOUftFTAQ9laJ7yImxSXn5LBYQYmiM2ZhSFD9OKaqW/+/W7U7mgudJ9Un5CEvcm1TP+LyyPnnQYfX+tP64ZzqRqrTKV1TiirRr8lis1UNIMlHMta0L/VWMyfg6MfKRzAQLAYoAfWUJE4kgWsRTSRUg+VIquNOdQGGLkf7mlKiMZ6rnAEMHcmAYiw19c4hwZx4YYD0zGj/SzgUYvOQfY1imC1XkyTIvUjyOk6ce1xVPEWNvBzJ0yQ= 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 Fri, Dec 01, 2023 at 05:22:26PM -0500, Waiman Long wrote: > On 12/1/23 14:08, Catalin Marinas wrote: > > diff --git a/mm/kmemleak.c b/mm/kmemleak.c > > index 1eacca03bedd..eb6cdc3e9af2 100644 > > --- a/mm/kmemleak.c > > +++ b/mm/kmemleak.c > > @@ -14,17 +14,15 @@ > > * The following locks and mutexes are used by kmemleak: > > * > > * - kmemleak_lock (raw_spinlock_t): protects the object_list as well as > > - * del_state modifications and accesses to the object_tree_root (or > > - * object_phys_tree_root). The object_list is the main list holding the > > - * metadata (struct kmemleak_object) for the allocated memory blocks. > > - * The object_tree_root and object_phys_tree_root are red > > - * black trees used to look-up metadata based on a pointer to the > > - * corresponding memory block. The object_phys_tree_root is for objects > > - * allocated with physical address. The kmemleak_object structures are > > - * added to the object_list and object_tree_root (or object_phys_tree_root) > > - * in the create_object() function called from the kmemleak_alloc() (or > > - * kmemleak_alloc_phys()) callback and removed in delete_object() called from > > - * the kmemleak_free() callback > > + * del_state modifications and accesses to the object trees > > + * (object_tree_root, object_phys_tree_root, object_percpu_tree_root). The > > + * object_list is the main list holding the metadata (struct > > + * kmemleak_object) for the allocated memory blocks. The object trees are > > + * red black trees used to look-up metadata based on a pointer to the > > + * corresponding memory block. The kmemleak_object structures are added to > > + * the object_list and the object tree root in the create_object() function > > + * called from the kmemleak_alloc() (or kmemleak_alloc_phys()) callback and > > + * removed in delete_object() called from the kmemleak_free() callback > > Just a minor nit. For completeness, should we mention > kmemleak_alloc_percpu() and kmemleak_free_percpu() here? Yeah, I was too lazy. I added some shell-style patterns and repost a v2. > Anyway, I won't mind if you want to keep it as it is. > > Reviewed-by: Waiman Long Thanks. -- Catalin