+ rbtree-use-read_once-in-rb_empty_root.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: rbtree: use READ_ONCE in RB_EMPTY_ROOT
has been added to the -mm tree.  Its filename is
     rbtree-use-read_once-in-rb_empty_root.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/rbtree-use-read_once-in-rb_empty_root.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/rbtree-use-read_once-in-rb_empty_root.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Davidlohr Bueso <dave@xxxxxxxxxxxx>
Subject: rbtree: use READ_ONCE in RB_EMPTY_ROOT

With d72da4a4d97 ("rbtree: Make lockless searches non-fatal") our rbtrees
provide weak guarantees that allows us to do lockless (and very
speculative) reads of the tree.  Such readers cannot see partial stores on
nodes, ie left/right as well as root.  As such, similar to the WRITE_ONCE
semantics when doing rotations, use READ_ONCE when checking the root node
in RB_EMPTY_ROOT.

Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Michel Lespinasse <walken@xxxxxxxxxx>
Cc: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/rbtree.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN include/linux/rbtree.h~rbtree-use-read_once-in-rb_empty_root include/linux/rbtree.h
--- a/include/linux/rbtree.h~rbtree-use-read_once-in-rb_empty_root
+++ a/include/linux/rbtree.h
@@ -50,7 +50,7 @@ struct rb_root {
 #define RB_ROOT	(struct rb_root) { NULL, }
 #define	rb_entry(ptr, type, member) container_of(ptr, type, member)
 
-#define RB_EMPTY_ROOT(root)  ((root)->rb_node == NULL)
+#define RB_EMPTY_ROOT(root)  (READ_ONCE((root)->rb_node) == NULL)
 
 /* 'empty' nodes are nodes that are known not to be inserted in an rbtree */
 #define RB_EMPTY_NODE(node)  \
_

Patches currently in -mm which might be from dave@xxxxxxxxxxxx are

rbtree-use-read_once-in-rb_empty_root.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux