From: Cody P Schafer <cody@linux.vnet.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
David Woodhouse <David.Woodhouse@intel.com>,
Rik van Riel <riel@redhat.com>,
Michel Lespinasse <walken@google.com>,
Seth Jennings <sjenning@linux.vnet.ibm.com>,
Cody P Schafer <cody@linux.vnet.ibm.com>
Subject: [PATCH 0/5] Add rbtree postorder iteration functions, runtime tests, and update zswap to use.
Date: Fri, 26 Jul 2013 14:13:38 -0700 [thread overview]
Message-ID: <1374873223-25557-1-git-send-email-cody@linux.vnet.ibm.com> (raw)
Postorder iteration yields all of a node's children prior to yielding the node
itself, and this particular implementation also avoids examining the leaf links
in a node after that node has been yielded.
In what I expect will be it's most common usage, postorder iteration allows the
deletion of every node in an rbtree without modifying the rbtree nodes (no
_requirement_ that they be nulled) while avoiding referencing child nodes after
they have been "deleted" (most commonly, freed).
I have only updated zswap to use this functionality at this point, but numerous
bits of code (most notably in the filesystem drivers) use a hand rolled
postorder iteration that NULLs child links as it traverses the tree. Each of
those instances could be replaced with this common implementation.
Cody P Schafer (5):
rbtree: add postorder iteration functions.
rbtree: add rbtree_postorder_for_each_entry_safe() helper.
rbtree_test: add test for postorder iteration.
rbtree: allow tests to run as builtin
mm/zswap: use postorder iteration when destroying rbtree
include/linux/rbtree.h | 21 +++++++++++++++++++++
lib/Kconfig.debug | 2 +-
lib/rbtree.c | 40 ++++++++++++++++++++++++++++++++++++++++
lib/rbtree_test.c | 12 ++++++++++++
mm/zswap.c | 15 ++-------------
5 files changed, 76 insertions(+), 14 deletions(-)
--
1.8.3.4
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2013-07-26 21:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-26 21:13 Cody P Schafer [this message]
2013-07-26 21:13 ` [PATCH 1/5] rbtree: add postorder iteration functions Cody P Schafer
2013-07-29 15:01 ` Seth Jennings
2013-07-29 17:32 ` Cody P Schafer
2013-07-26 21:13 ` [PATCH 2/5] rbtree: add rbtree_postorder_for_each_entry_safe() helper Cody P Schafer
2013-07-29 15:06 ` Seth Jennings
2013-07-29 17:41 ` Cody P Schafer
2013-07-26 21:13 ` [PATCH 3/5] rbtree_test: add test for postorder iteration Cody P Schafer
2013-07-26 21:13 ` [PATCH 4/5] rbtree: allow tests to run as builtin Cody P Schafer
2013-07-26 21:13 ` [PATCH 5/5] mm/zswap: use postorder iteration when destroying rbtree Cody P Schafer
2013-07-29 15:08 ` Seth Jennings
2013-07-29 15:11 ` [PATCH 0/5] Add rbtree postorder iteration functions, runtime tests, and update zswap to use Seth Jennings
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=1374873223-25557-1-git-send-email-cody@linux.vnet.ibm.com \
--to=cody@linux.vnet.ibm.com \
--cc=David.Woodhouse@intel.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
--cc=sjenning@linux.vnet.ibm.com \
--cc=walken@google.com \
/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;
as well as URLs for NNTP newsgroup(s).