[lkml]   [2010]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [patch 2/3] scheduler: add full memory barriers upon task switch at runqueue lock/unlock
    On Mon, 2010-02-01 at 11:09 -0500, Mathieu Desnoyers wrote:

    > We can deal with the rq->cur update by holding the rq lock in each
    > iteration of the for_each_cpu(cpu, mm_cpumask(current->mm)) loop. This
    > ensures that if rq->cur is updated, we have an associated memory barrier
    > issued (e.g. on x86, implied by writing to cr3 while the rq lock is held).
    > However, this does not deal with mm_cpumask update, and we cannot use
    > the per-cpu rq lock, as it's a process-wide data structure updated with
    > clear_bit/set_bit in switch_mm(). So at the very least, we would have to
    > add memory barriers in switch_mm() on some architectures to deal with
    > this.

    Doesn't set_bit imply a wmb()? If so couldn't we do:

    What about:

    tmp_mask = mm_cpumask(current->mm);
    rcu_read_lock(); /* ensures validity of cpu_curr(cpu) tasks */
    for_each_cpu(cpu, tmp_mask) {
    ret = current->mm == cpu_curr(cpu)->mm;
    if (ret)
    smp_call_function_single(cpu, membarrier_ipi, NULL, 1);
    if (tmp_mask != mm_cpumask(current->mm)) {
    /* do check for signals here */
    goto again;

    Would the above work?

    -- Steve

     \ /
      Last update: 2010-02-01 17:27    [W:0.021 / U:1.496 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site