]> git.baikalelectronics.ru Git - kernel.git/commit
lcoking/rwsem: Add missing ACQUIRE to read_slowpath sleep loop
authorPeter Zijlstra <peterz@infradead.org>
Thu, 18 Jul 2019 12:56:17 +0000 (14:56 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 25 Jul 2019 13:39:24 +0000 (15:39 +0200)
commit435d87abf0feef60723f470c3eca9dc1da15ea7b
treefb581b5301b554d40903c234e22ffab3b21b774b
parent21bb52591492b686946099d17df40819f6cc8260
lcoking/rwsem: Add missing ACQUIRE to read_slowpath sleep loop

While reviewing another read_slowpath patch, both Will and I noticed
another missing ACQUIRE, namely:

  X = 0;

  CPU0 CPU1

  rwsem_down_read()
    for (;;) {
      set_current_state(TASK_UNINTERRUPTIBLE);

                        X = 1;
                        rwsem_up_write();
                          rwsem_mark_wake()
                            atomic_long_add(adjustment, &sem->count);
                            smp_store_release(&waiter->task, NULL);

      if (!waiter.task)
        break;

      ...
    }

  r = X;

Allows 'r == 0'.

Reported-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Will Deacon <will@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/rwsem.c