From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
leon@kernel.org
Cc: linux-rdma@vger.kernel.org,
Guoqing Jiang <guoqing.jiang@linux.dev>,
kernel test robot <lkp@intel.com>
Subject: [PATCH V2 3/3] RDMA/rtrs-clt: Kill xchg_paths
Date: Thu, 8 Sep 2022 17:45:48 +0800 [thread overview]
Message-ID: <20220908094548.4115-4-guoqing.jiang@linux.dev> (raw)
In-Reply-To: <20220908094548.4115-1-guoqing.jiang@linux.dev>
Let's call try_cmpxchg directly for the same purpose.
Acked-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Reported-by: kernel test robot <lkp@intel.com>
---
drivers/infiniband/ulp/rtrs/rtrs-clt.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index c29eccdb4fd2..2428bf5d07e3 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -2220,17 +2220,6 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path)
}
}
-static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path,
- struct rtrs_clt_path *clt_path,
- struct rtrs_clt_path *next)
-{
- struct rtrs_clt_path **ppcpu_path;
-
- /* Call cmpxchg() without sparse warnings */
- ppcpu_path = (typeof(ppcpu_path))rcu_ppcpu_path;
- return clt_path == cmpxchg(ppcpu_path, clt_path, next);
-}
-
static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
{
struct rtrs_clt_sess *clt = clt_path->clt;
@@ -2305,7 +2294,8 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path)
* We race with IO code path, which also changes pointer,
* thus we have to be careful not to overwrite it.
*/
- if (xchg_paths(ppcpu_path, clt_path, next))
+ if (try_cmpxchg((struct rtrs_clt_path **)ppcpu_path,
+ &clt_path, next))
/*
* @ppcpu_path was successfully replaced with @next,
* that means that someone could also pick up the
--
2.31.1
next prev parent reply other threads:[~2022-09-08 9:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 9:45 [PATCH V2 0/3] misc changes for rtrs Guoqing Jiang
2022-09-08 9:45 ` [PATCH V2 1/3] RDMA/rtrs: Update comments for MAX_SESS_QUEUE_DEPTH Guoqing Jiang
2022-09-08 9:45 ` [PATCH V2 2/3] RDMA/rtrs-clt: Break the loop once one path is connected Guoqing Jiang
2022-09-08 9:45 ` Guoqing Jiang [this message]
2022-09-08 9:55 ` [PATCH V2 3/3] RDMA/rtrs-clt: Kill xchg_paths Haris Iqbal
2022-09-08 10:04 ` Guoqing Jiang
2022-09-09 14:15 ` Santosh Pradhan
2022-09-20 12:04 ` [PATCH V2 0/3] misc changes for rtrs Leon Romanovsky
2022-09-20 16:48 ` Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220908094548.4115-4-guoqing.jiang@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lkp@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).