Why is there no list_prev_rcu()?

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

 



Hey Paul,

I have a rather dumb question...

I'm keeping a very boring:

static LIST_HEAD(mnt_ns_list);

of mount namespaces. Userspace can pass a file descriptor for a mount
namespace in that list to the kernel and then open a file descriptor to
the next or previous mount namespace.

As I was working on that I found list_next_rcu() but no
list_prev_rcu(). Which made me curious and then I saw the comment in
commit afa47fdfa29f ("rculist.h: Add list_tail_rcu()").

/**
 * list_tail_rcu - returns the prev pointer of the head of the list
 * @head: the head of the list
 *
 * Note: This should only be used with the list header, and even then
 * only if list_del() and similar primitives are not also used on the
 * list header.
 */

That comment strongly suggests that list_prev_rcu() somehow isn't
generally safe to do? Is that the case and if so why? And what are
possible ways to safely get to the previous list entry under rcu?

(I'm currently doing this in an rbtree via rb_prev() and rb_next() but I
can't do either of those locklessly which is why I want to keep a list
in parallel as well.)

Thanks!
Christian




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux