rbd: optimize barrier usage for Rmw atomic bitops
Subsystems (2)
PATCH 1/1 rbd: optimize barrier usage for Rmw atomic bitops
For both set and clear_bit, we can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__{before,after}_atomic() calls.
Signed-off-by Davidlohr Bueso <[email protected]>
--- drivers/block/rbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/rbd.c +2 -2
@@ -1371,13 +1371,13 @@ static void rbd_osd_submit(struct ceph_osd_request *osd_req)static void img_request_layered_set (struct rbd_img_request *img_request) {set_bit (IMG_REQ_LAYERED , &img_request->flags); -smp_mb (); +smp_mb__after_atomic (); }static void img_request_layered_clear (struct rbd_img_request *img_request) {clear_bit (IMG_REQ_LAYERED , &img_request->flags); -smp_mb (); +smp_mb__after_atomic (); }static bool img_request_layered_test (struct rbd_img_request *img_request)
Signature · 1 line
2.16.4
Ilya Dryomov
maintainerQuoted 20 lines · Davidlohr Bueso
For both set and
clear_bit, we can avoid the unnecessary barrier on non LL/SC architectures, such as x86. Instead, use the smp_mb__{before,after}_atomic() calls.Signed-off-by Davidlohr Bueso <[email protected]>--- drivers/block/rbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/block/rbd.c +1
-1@@ -1371,13 +1371,13 @@ static void rbd_osd_submit(struct ceph_osd_request *osd_req)static void img_request_layered_set (struct rbd_img_request *img_request) {set_bit (IMG_REQ_LAYERED , &img_request->flags); -smp_mb (); +smp_mb__after_atomic ();
drivers/block/rbd.c static void rbd_osd_submit(struct ceph_osd_request *osd_req) · line 1383
Quoted 10 lines
drivers/block/rbd.c +1
-1}static void img_request_layered_clear (struct rbd_img_request *img_request) {clear_bit (IMG_REQ_LAYERED , &img_request->flags); -smp_mb (); +smp_mb__after_atomic (); }static bool img_request_layered_test (struct rbd_img_request *img_request)
Hi Davidlohr,
I don't think these barriers are needed at all. I'll remove them.
Thanks,
Ilya
Quoted 1 line · Ilya Dryomov
I don't think these barriers are needed at all. I'll remove them.
Even better, thanks.