From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Md Haris Iqbal <haris.iqbal@ionos.com>, linux-rdma@vger.kernel.org
Cc: leon@kernel.org, jgg@ziepe.ca, jinpu.wang@ionos.com,
Santosh Kumar Pradhan <santosh.pradhan@ionos.com>,
Christoph Lameter <cl@linux.com>
Subject: Re: [PATCH for-next 2/5] RDMA/rtrs-clt: Use this_cpu_ API for stats
Date: Fri, 8 Jul 2022 15:21:45 +0800 [thread overview]
Message-ID: <38039783-e274-917f-91ea-9f9de6cf74c9@linux.dev> (raw)
In-Reply-To: <20220707142144.459751-3-haris.iqbal@ionos.com>
On 7/7/22 10:21 PM, Md Haris Iqbal wrote:
> From: Santosh Kumar Pradhan <santosh.pradhan@ionos.com>
>
> Use this_cpu_x() for increasing/adding a percpu counter through a
> percpu pointer without the need to disable/enable preemption.
>
> Suggested-by: Christoph Lameter <cl@linux.com>
> Signed-off-by: Santosh Kumar Pradhan <santosh.pradhan@ionos.com>
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c b/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c
> index 385a19846c24..1e6ffafa2db3 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c
> @@ -32,11 +32,7 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con)
>
> void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *stats)
> {
> - struct rtrs_clt_stats_pcpu *s;
> -
> - s = get_cpu_ptr(stats->pcpu_stats);
> - s->rdma.failover_cnt++;
> - put_cpu_ptr(stats->pcpu_stats);
> + this_cpu_inc(stats->pcpu_stats->rdma.failover_cnt);
> }
>
> int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf)
> @@ -169,12 +165,8 @@ int rtrs_clt_reset_all_stats(struct rtrs_clt_stats *s, bool enable)
> static inline void rtrs_clt_update_rdma_stats(struct rtrs_clt_stats *stats,
> size_t size, int d)
> {
> - struct rtrs_clt_stats_pcpu *s;
> -
> - s = get_cpu_ptr(stats->pcpu_stats);
> - s->rdma.dir[d].cnt++;
> - s->rdma.dir[d].size_total += size;
> - put_cpu_ptr(stats->pcpu_stats);
> + this_cpu_inc(stats->pcpu_stats->rdma.dir[d].cnt);
> + this_cpu_add(stats->pcpu_stats->rdma.dir[d].size_total, size);
> }
>
> void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir)
Acked-by: Guoqing Jiang <guoqing.jiang@linux.dev>
Thanks,
Guoqing
next prev parent reply other threads:[~2022-07-08 7:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-07 14:21 [PATCH for-next 0/5] Misc patches for RTRS Md Haris Iqbal
2022-07-07 14:21 ` [PATCH for-next 1/5] RDMA/rtrs-srv: Fix modinfo output for stringify Md Haris Iqbal
2022-07-07 14:21 ` [PATCH for-next 2/5] RDMA/rtrs-clt: Use this_cpu_ API for stats Md Haris Iqbal
2022-07-08 7:21 ` Guoqing Jiang [this message]
2022-07-12 7:54 ` Christoph Lameter
2022-07-07 14:21 ` [PATCH for-next 3/5] RDMA/rtrs-srv: Use per-cpu variables for rdma stats Md Haris Iqbal
2022-07-07 14:21 ` [PATCH for-next 4/5] rtrs-clt: Replace list_next_or_null_rr_rcu with an inline function Md Haris Iqbal
2022-07-07 14:21 ` [PATCH for-next 5/5] RDMA/rtrs-srv: Do not use mempool for page allocation Md Haris Iqbal
2022-07-08 7:27 ` Guoqing Jiang
2022-07-08 13:32 ` Jason Gunthorpe
2022-07-12 7:36 ` Jinpu Wang
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=38039783-e274-917f-91ea-9f9de6cf74c9@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=cl@linux.com \
--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=santosh.pradhan@ionos.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.