At begin, I have one CPU core to be a writer to write shared data and one core to be reader to read shared data.
I need reader to write back some data to share data.
I know that rcu_read_lock()
/rcu_read_unlock()
are used for reader to get shared data. But I'm not sure reader write back to share data will cause any problem?
In reader:
rcu_read_lock();
//get shared data
//modify the data
rcu_assign_pointer(ptr1, ptr2)
rcu_read_unlock();
Is this code valid?