[Ocfs2-devel] + sysctl-use-rcu-protected-sysctl-for-ocfs-group-add-helper.patch added to -mm tree
Andi Kleen
andi at firstfloor.org
Fri Jan 8 22:41:08 PST 2010
> Accesses would be:
> char *str;
> rcu_read_lock();
> str = rcu_deref(NAME.str);
> ....
> rcu_read_unlock();
>
> Updates would be:
> char *next;
> mutex_lock(&rcu_string_mutex);
> next = rcu_string->data;
> if (next == rcu_string->str)
> next = rcu_string->data + rcu_string->size;
> memcpy(next, somestring_from_somewhere, rcu_string->size);
> next[rcu_string->size - 1] = '\0';
> rcu_string->str = next;
> synchronize_rcu();
> mutex_unlock(&rcu_string_mutex);
synchronize_rcu inside a lock is a bit nasty, but ok none of these
are critical.
>
> Thoughts?
It's not fully clear to me how this is better than my solution?
-Andi
--
ak at linux.intel.com -- Speaking for myself only.
More information about the Ocfs2-devel
mailing list