On Tue, Dec 05, 2017 at 12:53:36PM +0100, Thomas Monjalon wrote: > 05/12/2017 12:44, Ananyev, Konstantin: > > Just forgot to mention - I don' think it is good idea to disallow secondary > > process to set theowner. > > I think we all agree on that. > My initial suggestion was to use the ownership in secondary processes. > I think Matan forbid it as a first step because there is no > multi-process synchronization currently. > > > Let say in secondary process I have few tap/ring/pcap devices. > > Why it shouldn't be allowed to unite them under bonding device and make > > that device to own them? > > That's why I think get/set owner better to be atomic. > > If the owner is just a pointer - in that case get operation will be atomic > > by nature, > > set could be implemented just by CAS. > > It would be perfect. > Can we be sure that the atomic will work perfectly on shared memory?
The sharing of memory is an OS-level construct in managing page tables, more than anything else. For atomic operations, a memory address is a memory address, whether it is shared or private to a process. > On every architectures? All architectures should have an atomic compare-and-set equivalent operation for it's native pointer size. In the unlikely case we have to support one that doesn't, we can special-case that in some other way.