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 25AEDC43334 for ; Tue, 12 Jul 2022 14:54:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD59D6B012F; Tue, 12 Jul 2022 10:54:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5E046B0130; Tue, 12 Jul 2022 10:54:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FEEE940063; Tue, 12 Jul 2022 10:54:17 -0400 (EDT) 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 8EC9C6B012F for ; Tue, 12 Jul 2022 10:54:17 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 5A92C6EB for ; Tue, 12 Jul 2022 14:54:17 +0000 (UTC) X-FDA: 79678743354.24.17E0968 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf02.hostedemail.com (Postfix) with ESMTP id 6B0FD80029 for ; Tue, 12 Jul 2022 14:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+k83zGSxic1pbQTEJQS/iJCti7MTxdVcT9sj/XVqF9o=; b=AYur2/Yrsq3i8wnAiMQB5+HeGR Cw1t1umk+nFN6rzDv9R8Kx4j4+IbnkrgsEYyIxGKCrGXH6RGeySCrD/75ebbwoNRX6FXZg7zYOoQc pJBZfDHzeAgsQRlmUhdHkHxwaGQOmL2mvL1ysNWIPqYKl9LMq/2DvVjIMG7cj9aEcdqyWr12Nrl8K feqbLA6Rp/mCUDdslVe8t1ZDq6J4/VzufUvgGfcElp1Rxm7X5tHtU5VVjuExRYm15zBZ9jGtrDFgo W1AFvEjia6lwr0qz3ZrxQbsxetPO8Sk9Ib085EHPXQO8BCZbu3E8uJcFxAn+16vN9oGyKsgSFcG7g EtYvT1Xg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBHH1-00715O-MX; Tue, 12 Jul 2022 14:54:03 +0000 Date: Tue, 12 Jul 2022 15:54:03 +0100 From: Matthew Wilcox To: Liam Howlett Cc: "maple-tree@lists.infradead.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Andrew Morton Subject: Re: [PATCH] maple_tree: Fix sparse reported issues Message-ID: References: <20220712142441.4184969-1-Liam.Howlett@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220712142441.4184969-1-Liam.Howlett@oracle.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657637656; 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:dkim-signature; bh=+k83zGSxic1pbQTEJQS/iJCti7MTxdVcT9sj/XVqF9o=; b=yIkrRUn8kQIJYEmBJ7apfwySp4z9KHJSEDtDC+C0ejcr+3oANjMr+Gur9efZYz/H1eIQwa PGflbgoHkMxVfE54QHoXFD54lRIweuqYAeWKk4OJaABO1xrHLI7Ru99lYazBVDGyaGRTji nbhowcyOSHC0GC3HBWcqRcyfq7t6qC4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="AYur2/Yr"; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657637656; a=rsa-sha256; cv=none; b=vtM9AAPqTLR3zkIfu0oRTvfLK6fbbrjIPUZgnhzef5PvO8730dBkLaLvlIR16G1qa2N1Il 5s6aOBP81nqd0lztcefZO46X4ECLXXENDxFW8y9g1EnFkvEL0F1BDYlVcO4Jh+nfAYw7VX m6gsY3/1GDS+olGldHm4PuIp1kBLnzw= X-Stat-Signature: onbs49czu5wrxz9yerkzqb1yaxzkbf63 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6B0FD80029 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="AYur2/Yr"; dmarc=none; spf=none (imf02.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-HE-Tag: 1657637654-776302 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 Tue, Jul 12, 2022 at 02:24:55PM +0000, Liam Howlett wrote: > When building with C=1, the maple tree had some rcu type mismatch & > locking mismatches in the destroy functions. There were cosmetic only > since this happens after the nodes are removed from the tree. ... in the current use-case. It's a legitimate use of the API to do: ma_init(); ma_store(); ma_destroy(); ma_store(); Can you add a new test that does that? > @@ -5524,13 +5526,17 @@ static void mt_destroy_walk(struct maple_enode *enode, unsigned char ma_flags, > > type = mte_node_type(mas.node); > slots = ma_slots(mte_to_node(mas.node), type); > - if ((offset < mt_slots[type]) && mte_node_type(slots[offset]) && > - mte_to_node(slots[offset])) { > - struct maple_enode *parent = mas.node; > + if (offset >= mt_slots[type]) > + goto next; > > - mas.node = mas_slot_locked(&mas, slots, offset); > + tmp = mas_slot_locked(&mas, slots, offset); > + if (mte_node_type(tmp) && mte_to_node(tmp)) { > + Unnecessary blank line? > + parent = mas.node; > + mas.node = tmp; > slots = mas_destroy_descend(&mas, parent, offset); > } > +next: > node = mas_mn(&mas); > } while (start != mas.node); > > -- > 2.35.1 >