linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Liam Howlett <liam.howlett@oracle.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] maple_tree: Fix sparse reported issues
Date: Tue, 12 Jul 2022 15:44:09 +0000	[thread overview]
Message-ID: <20220712154401.hh5ibuw7d3qlrd4r@revolver> (raw)
In-Reply-To: <Ys2LCwQZUuOwiiX6@casper.infradead.org>

* Matthew Wilcox <willy@infradead.org> [220712 10:54]:
> 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?

I can add this, but a few notes on it.

The function names are mt_init(), mtree_store(), and mtree_destroy().
There is an internal/advanced __mt_destroy().  Both destroy functions
clear the flags - which I think is desirable.

> 
> > @@ -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?

ack, I'll remove that.


> 
> > +			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
> > 
> 
> -- 
> maple-tree mailing list
> maple-tree@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/maple-tree

  reply	other threads:[~2022-07-12 15:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-12 14:24 Liam Howlett
2022-07-12 14:54 ` Matthew Wilcox
2022-07-12 15:44   ` Liam Howlett [this message]
2022-07-13  8:34 ` David Hildenbrand
2022-07-13 13:29   ` Liam Howlett
2022-07-13 15:55     ` Hugh Dickins
2022-07-13 17:50       ` Liam Howlett
2022-07-15 19:53         ` Liam Howlett
2022-07-17 20:57           ` Hugh Dickins
2022-07-18  2:27             ` Liam Howlett
2022-07-18  4:28               ` Hugh Dickins
2022-07-18  6:47                 ` Hugh Dickins
2022-07-18 12:56                 ` Liam Howlett
2022-07-18 13:45                   ` Liam Howlett
2022-07-18 17:30                     ` Hugh Dickins
2022-07-18 17:47                       ` Liam Howlett
2022-07-18 21:34                         ` Hugh Dickins
2022-07-19  1:39                           ` Liam Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220712154401.hh5ibuw7d3qlrd4r@revolver \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox