Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp907312rdb; Wed, 6 Dec 2023 03:31:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDJ+MVIZkmVp1yunYOim4+JI6NR7KKDRiVSgAs/XKVAe6bpm1ZP4T3s3S3cJAJSFzSGe5Y X-Received: by 2002:a05:6a21:1f0f:b0:18f:9c4:d33e with SMTP id ry15-20020a056a211f0f00b0018f09c4d33emr3088204pzb.46.1701862299727; Wed, 06 Dec 2023 03:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701862299; cv=none; d=google.com; s=arc-20160816; b=xGw0BPebo+rySvpkUv6LxtRqdAL63fKKamFcEOcPukcPYkRuoxFFOjL4Xh0toPSf1N zxWzMhnGRnxp6eCNTZzg4OSQhmcZAv3wSBPIpJF+XeKr0IHWxcnxPYI4K11FMmg5ux77 fA6Qu/ZvzR7NSWZeFrmao5UKo2PEWqODTXCX9pEN7UZI1LwQ5xc05asez6jROgHbmBFM 0gfKUe5VzOeWPulfvnhggfGL7NAkqHgMbAiTA9nxoOCfnhnOzfTzVm4UuidRYbZaPMbL 5ytNjmg66ix3sMBRGDa+llrYajD4XBotr+CPR+J84PdZJidrb120R8Nesy50W/QtYL3X 0Phw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=R0cYwSi/es2Ew3j4iWADhi969rVZBOPlMqaknlbKEvQ=; fh=hATGkAcU/TNpcJjOI9mOTB4uzWVIXx1b+2y0eUPwK4c=; b=acCuFerlY6mu92NBhLvEiOnzLu8HtY1xD0ucsBvzwKMsm24H0kDI9Ep2vs0eUQzjTQ RHIYD1Ves6RJOH0t5go2MtpvnBdQ637I0A5Ol5GtE4ruY4gED+hq/Ye5YUUlszbS4YnM H3wPgQO5iN+AFKXIC2HH6RqtKufpQmfmTS4B0lH4p6n15XD5V4uiKCN1F/X9A7jomX9q xo9M0U3ipL5yhqKUkcqYsmf8MfJaO5kT4HaRIVF3qWLeBkBwP1OHakpRRROmaoW315Eq hEYvAtaJDDjhjHZqC0IdNKX1xI+A5obJpbiUTcDtvj0vzRF9XZ2y9IRwuaPsxYJmWpta S7Mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id w64-20020a638243000000b005c6bc2367ebsi1494445pgd.216.2023.12.06.03.31.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 03:31:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0BEA880BFEFA; Wed, 6 Dec 2023 03:31:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377539AbjLFLbU (ORCPT + 99 others); Wed, 6 Dec 2023 06:31:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377753AbjLFLbM (ORCPT ); Wed, 6 Dec 2023 06:31:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CDF1A5 for ; Wed, 6 Dec 2023 03:31:18 -0800 (PST) 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-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 03:31:37 -0800 (PST) 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