]> www.infradead.org Git - users/jedix/linux-maple.git/commit
percpu_ref: unify staggered atomic switching wait behavior
authorTejun Heo <tj@kernel.org>
Tue, 29 Sep 2015 21:47:18 +0000 (17:47 -0400)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 18 Jun 2017 21:04:08 +0000 (14:04 -0700)
commitb369c3c81968a92c8283b7312f3a84f9de8db42a
tree364bf3fd2bbf9bf1eb11994bce96cf6780b9684b
parent8f795fc8c7afaee44dc5466586916997d4b5ee8e
percpu_ref: unify staggered atomic switching wait behavior

When an atomic or percpu switching starts before the previous atomic
switching finishes, the taken behaviors are

* If the new atomic switching has confirmation callback, it waits
  for the previous atomic switching to complete.

* If the new percpu switching is the first percpu switching following
  the previous atomic switching, it waits the previous atomic
  switching to complete.

No percpu_ref user depends on these subtleties.  The only meaningful
part is that, if the caller ensures that atomic switching isn't in
progress, mode switching operations can be issued from any context.

This patch pulls the wait logic to the top of both switching functions
so that they always wait for the previous atomic switching to
complete.  This makes the behavior simpler and consistent for both
directions and will help allowing concurrent invocations of mode
switching functions.

Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 18808354b79622ed11857e41f9044ba17aec5b01)

Orabug: 26254388

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Ashok Vairavan <ashok.vairavan@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
lib/percpu-refcount.c