From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A67F481FAC for ; Wed, 21 Jan 2026 13:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769003575; cv=none; b=I2aLw3nBctumHh9TuVFZnv7nugXRe57+o9VgycNukwiw8whrgIbuqg2Qw3yYY4j2w5JYHVb5bGy9VJMANC5lc3yBK2mwp3XtZ6yUVavVni/QhxsFn0JntMZEF2E1uhdQcOi3rKLEo1KDK7hPOaYojHh1CRe0/mWkCB79Pl0LWl0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769003575; c=relaxed/simple; bh=KAZjiOG84uhTT1xrMzgvUUsa4yDk9dITLZpILgWJD3g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=buWyAqE+g7dN4QV7LTzFjJA0ZPlfejX5ivVpcDjE8fATDpytvDrF80q/W8YuIs4RKi5QksNawoW/UVQcFSeCEkXnfMvECX8UFFUgF4rpHY+HRliyfqfP56GQdZtrPsjOPwYagHSRMhczUffBDq6box8CT1jfjYAAlbBP+7jVlPE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=delta-utec.com; spf=none smtp.mailfrom=delta-utec.com; dkim=pass (2048-bit key) header.d=delta-utec-com.20230601.gappssmtp.com header.i=@delta-utec-com.20230601.gappssmtp.com header.b=1rY2FOrq; arc=none smtp.client-ip=209.85.208.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=delta-utec.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=delta-utec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=delta-utec-com.20230601.gappssmtp.com header.i=@delta-utec-com.20230601.gappssmtp.com header.b="1rY2FOrq" Received: by mail-ed1-f68.google.com with SMTP id 4fb4d7f45d1cf-6581327d6baso1658392a12.3 for ; Wed, 21 Jan 2026 05:52:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delta-utec-com.20230601.gappssmtp.com; s=20230601; t=1769003571; x=1769608371; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HNPZ06gyhsAi89oTZ9bVWE4SZCuvGGleeew03mDE5gs=; b=1rY2FOrqLE7QMeTPAw49TrtdB8IiqNmyXWDpeXwdG6tkVJO4o9odFxzFRPlrE5Afhv E3x6NGXlUtDUXzxseS1/IAYqctFxshos7XduIm5fNd26aik1iRPtAmF0QVzYx+O3dd85 2yJ9Kh29a6caWOTHL7ntwMstmDKPPQEtgmq1ukGl6lN51+d9ZECNDWDC4yjqguYKngJn X3Wp+K2EnB/TsiYdNnFqflVlomiLljzUEKcXbOOeVx9Lp93j2FTbmXoJEnXsHB6IZlHq 9R8YU1kH/Y+HgB8YwnujpaWtZQGGULaO5ecXCSGKPhfJICjaxifavF/6HiUZxQ3lg8Co Pd8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769003571; x=1769608371; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HNPZ06gyhsAi89oTZ9bVWE4SZCuvGGleeew03mDE5gs=; b=o5XElTi+jiKAyptcwFp50p0KnB+T4jYwCAC98pRWSjCm+GlUVveq/+0thR4XkCYoxX Qug0/uy+7EOfM+nRjXzl7M4rBMN9SMVrZe5B4GIECEFNxHMs/3mkBN33EWx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b0:b70:ac7a:2a93 with SMTP id a640c23a62f3a-b88003649eemr505557566b.43.1769003571363; Wed, 21 Jan 2026 05:52:51 -0800 (PST) Received: from bou-desktop.arnhem.chello.nl (2001-1c00-3406-8400-8d28-76bd-624c-ed78.cable.dynamic.v6.ziggo.nl. [2001:1c00:3406:8400:8d28:76bd:624c:ed78]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b87f3b05154sm513246666b.44.2026.01.21.05.52.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 05:52:50 -0800 (PST) From: Boudewijn van der Heide To: liam.howlett@oracle.com Cc: akpm@linux-foundation.org, aliceryhl@google.com, andrewjballance@gmail.com, boudewijn@delta-utec.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, maple-tree@lists.infradead.org Subject: Re: [PATCH v2] maple_tree: Add lockdep assertion in mas_dup_alloc() Date: Wed, 21 Jan 2026 14:52:38 +0100 Message-ID: <20260121135238.26578-1-boudewijn@delta-utec.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Thanks for the review! That makes sense, I overlooked this detail in v2. We should absolutely just check in __mt_dup(), like mtree_dup() does for actual locks. I took a closer look at __mt_dup() and mtree_dup(), and I saw that mtree_dup() locks both the new and old maple_tree. So I think it also makes sense for us to assert both trees in __mt_dup(), like this: @@ -6379,6 +6379,9 @@ int __mt_dup(struct maple_tree *mt, struct maple_tree *new, gfp_t gfp) MA_STATE(mas, mt, 0, 0); MA_STATE(new_mas, new, 0, 0); + lockdep_assert(mt_write_locked(new)); + lockdep_assert(mt_write_locked(mt)); + mas_dup_build(&mas, &new_mas, gfp); if (unlikely(mas_is_err(&mas))) { ret = xa_err(mas.node); Does that look good to you for v3? > > /* Allocate memory for child nodes. */ > > type = mte_node_type(mas->node); > > new_slots = ma_slots(new_node, type); > > -- > > 2.47.3 > > > > > Thanks, Boudewijn