Info

static inline void list_add_rcu(struct list_head *new, struct list_head *head) static inline void list_add_tail_rcu(struct list_head *new, struct list_head *head) static inline void list_del_rcu(struct list_head *entry) static inline void list_replace_rcu(struct list_head *old, struct list_head *new)

□ list_add_rcu adds a new element new to the beginning of a list headed by head, while list_add_tail_rcu adds it to the end.

□ list_replace_rcu replaces the list element old with new.

□ list_del_rcu removes the element entry from its list.

Most importantly, list_for_each_rcu allows for iterating over all elements of a list. The variant list_for_each_rcu_safe is even safe against element removal.

Both operations must be enclosed in a rcu_read_lock() ... rcu_read_unlock() pair.

Notice that the kernel provides a large amount of documentation about RCU by the creator of the mechanism. It is located in Documentation/RCU and makes for a very interesting read — especially because it is not outdated like many other texts included in the kernel. The documents not only provide information about how RCU is implemented, but additionally introduce some further standard functions not covered here because their use in the kernel is not so common.

Continue reading here: Info

Was this article helpful?

0 0