rds: introduce acquire/release ordering in acquire/release_in_xmit()
Subsystems (4)
PATCH 1/1 rds: introduce acquire/release ordering in acquire/release_in_xmit()
acquire/release_in_xmit() work as bit lock in rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, following smp_mb__after_atomic() does not guarantee release ordering (memory barrier actually should be placed before clear_bit()).
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
--- net/rds/send.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/rds/send.c +2 -3
@@ -103,13 +103,12 @@ EXPORT_SYMBOL_GPL(rds_send_path_reset);static int acquire_in_xmit (struct rds_conn_path *cp) { -return test_and_set_bit (RDS_IN_XMIT , &cp->cp_flags) ==0 ; +return test_and_set_bit_lock (RDS_IN_XMIT , &cp->cp_flags) ==0 ; }static void release_in_xmit (struct rds_conn_path *cp) { -clear_bit (RDS_IN_XMIT , &cp->cp_flags); -smp_mb__after_atomic (); +clear_bit_unlock (RDS_IN_XMIT , &cp->cp_flags);/* * We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Signature · 1 line
2.43.0
Quoted 9 lines · Yewon Choi
acquire/release_in_xmit() work as bit lock in
rds_send_xmit(), so they are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on top of this, followingsmp_mb__after_atomic()does not guarantee release ordering (memory barrier actually should be placed beforeclear_bit()).Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
Signed-off-by Yewon Choi <[email protected]>
Missing "Fixes" tag for the patch addressed to the "net" tree.
Thanks,
Michal
Allison Henderson
Reviewed-byQuoted 11 lines · Michal Kubiak
Quoted 10 lines · Yewon Choi
acquire/release_in_xmit() work as bit lock in
rds_send_xmit(), so they
are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on
top of this, followingsmp_mb__after_atomic()does not guarantee release
ordering (memory barrier actually should be placed beforeclear_bit()).
Quoted 8 lines
Quoted 3 lines
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
Signed-off-by Yewon Choi <[email protected]>Missing "Fixes" tag for the patch addressed to the "net" tree.
Thanks,
Michal
Yes, I think it needs:
Since that is the last patch to modify the affected code. Other than that I think the patch looks good. With the tag fixed, you can add my rvb:
Quoted 1 line
Quoted 12 lines · Allison Henderson
Quoted 11 lines · Michal Kubiak
Quoted 10 lines · Yewon Choi
acquire/release_in_xmit() work as bit lock in
rds_send_xmit(), so they
are expected to ensure acquire/release memory ordering semantics. However, test_and_set_bit/clear_bit() don't imply such semantics, on
top of this, followingsmp_mb__after_atomic()does not guarantee release
ordering (memory barrier actually should be placed beforeclear_bit()).
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Instead, we use clear_bit_unlock/test_and_set_bit_lock() here.
Signed-off-by Yewon Choi <[email protected]>Missing "Fixes" tag for the patch addressed to the "net" tree.
Sorry for mistake, I'll correct this and send v2 patch.
Quoted 11 lines
Quoted 2 lines
Thanks,
MichalYes, I think it needs:
Fixes 1f9ecd7eacfd ("RDS: Pass rds_conn_path to rds_send_xmit()")Since that is the last patch to modify the affected code. Other than that I think the patch looks good. With the tag fixed, you can add my rvb:
Also, test_and_set_bit/clear_bit() was first introduced in commit 0f4b1c7e89e6. I think this can be added, too:
Quoted 3 lines
Reviewed-by Allison Henderson <[email protected]>Quoted 1 line
Thank you for the reviewing.
Sincerely,
Yewon Choi