linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Magenheimer <dan.magenheimer@oracle.com>
To: Paul Mundt <lethal@linux-sh.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: RE: [RFC] radix_tree_destroy?
Date: Fri, 17 Dec 2010 10:44:06 -0800 (PST)	[thread overview]
Message-ID: <7fbf2264-04be-4899-9c1f-5c2e0942b158@default> (raw)
In-Reply-To: <20101217032721.GD20847@linux-sh.org>

> > +void radix_tree_destroy(struct radix_tree_root *root, void
> (*slot_free)(void *))
> > +{
> > +	if (root->rnode == NULL)
> > +		return;
> > +	if (root->height == 0)
> > +		slot_free(root->rnode);
> 
> Don't you want indirect_to_ptr(root->rnode) here? You probably also
> don't
> want the callback in the !radix_tree_is_indirect_ptr() case.
> 
> > +	else {
> > +		radix_tree_node_destroy(root->rnode, root->height,
> slot_free);
> > +		radix_tree_node_free(root->rnode);
> > +		root->height = 0;
> > +	}
> > +	root->rnode = NULL;
> > +}
> 
> The above will handle the nodes, but what about the root? It looks like
> you're at least going to leak tags on the root, so at the very least
> you'd still want a root_tag_clear_all() here.

Thanks for your help.  Will do both.  My use model doesn't require
tags or rcu, so my hacked version of radix_tree_destroy missed those
subtleties.

So my assumption was correct?  There is no way to efficiently
destroy an entire radix tree without adding this new routine?

Thanks,
Dan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-12-17 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-16 16:27 Dan Magenheimer
2010-12-17  3:27 ` Paul Mundt
2010-12-17 18:44   ` Dan Magenheimer [this message]
2010-12-22  3:15     ` Paul Mundt

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=7fbf2264-04be-4899-9c1f-5c2e0942b158@default \
    --to=dan.magenheimer@oracle.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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