• Andrew Morton's avatar
    [PATCH] memory barrier work in ipc/util.c · 622d2a68
    Andrew Morton authored
    Patch from Mingming Cao <cmm@us.ibm.com>
    
    - ipc_lock() need a read_barrier_depends() to prevent indexing
      uninitialized new array on the read side.  This is corresponding to
      the write memory barrier added in grow_ary() from Dipankar's patch to
      prevent indexing uninitialized array.
    
    - Replaced "wmb()" in IPC code with "smp_wmb()"."wmb()" produces a
      full write memory barrier in both UP and SMP kernels, while
      "smp_wmb()" provides a full write memory barrier in an SMP kernel,
      but only a compiler directive in a UP kernel.  The same change are
      made for "rmb()".
    
    - Removed rmb() in ipc_get().  We do not need a read memory barrier
      there since ipc_get() is protected by ipc_ids.sem semaphore.
    
    - Added more comments about why write barriers and read barriers are
      needed (or not needed) here or there.
    622d2a68
util.c 13.4 KB