#include <linux/rcupdate.h> #include <pthread.h> #include <stdio.h> #include <assert.h> static pthread_mutex_t rculock = PTHREAD_MUTEX_INITIALIZER; static struct rcu_head *rcuhead_global = NULL; static __thread int nr_rcuhead = 0; static __thread struct rcu_head *rcuhead = NULL; static __thread struct rcu_head *rcutail = NULL; static pthread_cond_t rcu_worker_cond = PTHREAD_COND_INITIALIZER; /* switch to urcu implementation when it is merged. */
void call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *head)) { head->func = func; head->next = rcuhead; rcuhead = head; if (!rcutail) rcutail = head; nr_rcuhead++; if (nr_rcuhead >= 1000) { int signal = 0; pthread_mutex_lock(&rculock); if (!rcuhead_global) signal = 1; rcutail->next = rcuhead_global; rcuhead_global = head; pthread_mutex_unlock(&rculock); nr_rcuhead = 0; rcuhead = NULL; rcutail = NULL; if (signal) { pthread_cond_signal(&rcu_worker_cond); } } }Contributors
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 118 | 100.00% | 1 | 100.00% |
Total | 118 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 96 | 100.00% | 1 | 100.00% |
Total | 96 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 19 | 100.00% | 1 | 100.00% |
Total | 19 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 10 | 100.00% | 1 | 100.00% |
Total | 10 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 10 | 100.00% | 1 | 100.00% |
Total | 10 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp | |
matthew wilcox | matthew wilcox | 315 | 100.00% | 1 | 100.00% |
Total | 315 | 100.00% | 1 | 100.00% |