From: Jason Gunthorpe <jgg@nvidia.com>
To: Gioh Kim <gi-oh.kim@ionos.com>
Cc: linux-rdma@vger.kernel.org, bvanassche@acm.org, leon@kernel.org,
dledford@redhat.com, haris.iqbal@ionos.com, jinpu.wang@ionos.com,
Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
Subject: Re: [PATCHv2 for-next 13/19] RDMA/rtrs-srv: Replace atomic_t with percpu_ref for ids_inflight
Date: Tue, 25 May 2021 17:15:43 -0300 [thread overview]
Message-ID: <20210525201543.GA3482418@nvidia.com> (raw)
In-Reply-To: <20210517091844.260810-14-gi-oh.kim@ionos.com>
On Mon, May 17, 2021 at 11:18:37AM +0200, Gioh Kim wrote:
> From: Md Haris Iqbal <haris.iqbal@cloud.ionos.com>
>
> ids_inflight is used to track the inflight IOs. But the use of atomic_t
> variable can cause performance drops and can also become a performance
> bottleneck.
>
> This commit replaces the use of atomic_t with a percpu_ref structure. The
> advantage it offers is, it doesn't check if the reference has fallen to 0,
> until the user explicitly signals it to; and that is done by the
> percpu_ref_kill() function call. After that, the percpu_ref structure
> behaves like an atomic_t and for every put call, checks whether the
> reference has fallen to 0 or not.
>
> rtrs_srv_stats_rdma_to_str shows the count of ids_inflight as 0
> for user-mode tools not to be confused.
>
> Fixes: 9cb837480424e ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> Signed-off-by: Gioh Kim <gi-oh.kim@ionos.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-srv-stats.c | 12 +++---
> drivers/infiniband/ulp/rtrs/rtrs-srv.c | 43 +++++++++++++-------
> drivers/infiniband/ulp/rtrs/rtrs-srv.h | 4 +-
> 3 files changed, 35 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-stats.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-stats.c
> index e102b1368d0c..df1d7d6b1884 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-stats.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-stats.c
> @@ -27,12 +27,10 @@ ssize_t rtrs_srv_stats_rdma_to_str(struct rtrs_srv_stats *stats,
> char *page, size_t len)
> {
> struct rtrs_srv_stats_rdma_stats *r = &stats->rdma_stats;
> - struct rtrs_srv_sess *sess = stats->sess;
>
> - return scnprintf(page, len, "%lld %lld %lld %lld %u\n",
> - (s64)atomic64_read(&r->dir[READ].cnt),
> - (s64)atomic64_read(&r->dir[READ].size_total),
> - (s64)atomic64_read(&r->dir[WRITE].cnt),
> - (s64)atomic64_read(&r->dir[WRITE].size_total),
> - atomic_read(&sess->ids_inflight));
> + return sysfs_emit(page, "%lld %lld %lld %lldn\n",
> + (s64)atomic64_read(&r->dir[READ].cnt),
> + (s64)atomic64_read(&r->dir[READ].size_total),
> + (s64)atomic64_read(&r->dir[WRITE].cnt),
> + (s64)atomic64_read(&r->dir[WRITE].size_total));
> }
This seems like an unrelated hunk
Jason
next prev parent reply other threads:[~2021-05-25 20:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-17 9:18 [PATCHv2 for-next 00/19] Misc update for rtrs Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 01/19] RDMA/rtrs-srv: Kill reject_w_econnreset label Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 02/19] RDMA/rtrs-clt: Remove MAX_SESS_QUEUE_DEPTH from rtrs_send_sess_info Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 03/19] RDMA/rtrs-srv: Add error messages for cases when failing RDMA connection Gioh Kim
2021-05-25 20:18 ` Jason Gunthorpe
2021-05-26 9:28 ` Haris Iqbal
2021-05-26 16:07 ` Jason Gunthorpe
2021-05-27 9:26 ` Haris Iqbal
2021-05-17 9:18 ` [PATCHv2 for-next 04/19] RDMA/rtrs-srv: Clean up the code in __rtrs_srv_change_state Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 05/19] RDMA/rtrs: Change MAX_SESS_QUEUE_DEPTH Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 06/19] RDMA/rtrs: Define MIN_CHUNK_SIZE Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 07/19] RDMA/rtrs: Use strscpy instead of strlcpy Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 08/19] RDMA/rtrs-clt: Kill rtrs_clt_{start,stop}_hb Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 09/19] RDMA/rtrs-clt: Kill rtrs_clt_disconnect_from_sysfs Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 10/19] RDMA/rtrs-srv: Kill __rtrs_srv_change_state Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 11/19] RDMA/rtrs-clt: Remove redundant 'break' Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 12/19] RDMA/rtrs-clt: Check state of the rtrs_clt_sess before reading its stats Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 13/19] RDMA/rtrs-srv: Replace atomic_t with percpu_ref for ids_inflight Gioh Kim
2021-05-25 20:15 ` Jason Gunthorpe [this message]
2021-05-26 9:16 ` Haris Iqbal
2021-05-26 9:38 ` Jinpu Wang
2021-05-27 9:25 ` Haris Iqbal
2021-05-17 9:18 ` [PATCHv2 for-next 14/19] RDMA/rtrs: Do not reset hb_missed_max after re-connection Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 15/19] RDMA/rtrs-srv: Duplicated session name is not allowed Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 16/19] RDMA/rtrs-srv: Fix memory leak of unfreed rtrs_srv_stats object Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 17/19] RDMA/rtrs-srv: Fix memory leak when having multiple sessions Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 18/19] RDMA/rtrs-clt: Check if the queue_depth has changed during a reconnection Gioh Kim
2021-05-17 9:18 ` [PATCHv2 for-next 19/19] RDMA/rtrs-clt: Fix memory leak of not-freed sess->stats and stats->pcpu_stats Gioh Kim
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=20210525201543.GA3482418@nvidia.com \
--to=jgg@nvidia.com \
--cc=bvanassche@acm.org \
--cc=dledford@redhat.com \
--cc=gi-oh.kim@ionos.com \
--cc=haris.iqbal@cloud.ionos.com \
--cc=haris.iqbal@ionos.com \
--cc=jinpu.wang@ionos.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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