Messages in this thread | | | Date | Thu, 7 Jan 2010 10:40:16 -0800 | From | "Paul E. McKenney" <> | Subject | Re: [RFC PATCH] introduce sys_membarrier(): process-wide memory barrier |
| |
On Thu, Jan 07, 2010 at 01:04:07PM -0500, Steven Rostedt wrote: > On Thu, 2010-01-07 at 09:56 -0800, Paul E. McKenney wrote: > > On Thu, Jan 07, 2010 at 12:44:37PM -0500, Steven Rostedt wrote: > > > On Thu, 2010-01-07 at 09:31 -0800, Paul E. McKenney wrote: > > > > > > > Something like the following for sys_membarrier(), then? > > > > > > > > smp_mb(); > > > > for_each_cpu(cpu, current->mm->cpu_vm_mask) { > > > > if (cpu_curr(cpu)->mm == current->mm) > > > > smp_call_function_single(cpu, func, NULL, 1); > > > > } > > > > > > > > Then the code changing ->mm on the other CPU also needs to have a > > > > full smp_mb() somewhere after the change to ->mm, but before starting > > > > user-space execution. Which it might well just due to overhead, but > > > > we need to make sure that someone doesn't optimize us out of existence. > > > > > > To change the mm requires things like flushing the TLB. I'd be surprised > > > if the change of the mm does not already do a smp_mb() somewhere. > > > > Agreed, but "somewhere" does not fill me with warm fuzzies. ;-) > > Another question would be, does flushing the TLB imply a mb()?
I do not believe that it is guaranteed to on all architectures.
Thanx, Paul
| |