[lkml]   [1999]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: spin_unlock optimization(i386)
    Andrea Arcangeli wrote:
    > So we could reimplement a rmb() (and in turn an mb()) that scales in SMP?
    > Something like:
    > #define rmb() ... "movb $0, ZERO_PAGE+32*smp_processor_id()"
    > Am I missing something?
    > Andrea
    What's the definition of a read memory barrier?
    IA32 allows that reads are executed before a following read, and before
    a following write call, but everything else is prohibited.

    read a
    write b <<<<<< end of the spinlock protected area
    read c
    read d

    could be reordered as
    read a
    read d
    read c
    write b <<<<<<<< end of the spinlock protected area

    this is acceptable for a spinlock: the CPU executes additional
    instructions, but never _fewer_ instructions, within the protected area.

    The only operation which must not happen is that "read a" is executed
    _after_ write b, and this doesn't happen.

    AFAICS, the rmb() during set_current_state() is still required:

    if(inode->i_state & I_LOCK) {

    without rmb(), current->state=TASK_UNINTERRUPTIBLE would be a normal
    write, and thus the following read for inode->i_state could be executed
    _before_ setting state -> wake-up is lost.


    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:55    [W:0.025 / U:35.308 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site