From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Jinpu Wang <jinpu.wang@ionos.com>, Christoph Lameter <cl@gentwo.org>
Cc: haris.iqbal@ionos.com, jgg@ziepe.ca, linux-rdma@vger.kernel.org
Subject: Re: [PATCH V2] RDMA/rtrs: Call {get,put}_cpu_ptr to silence a debug kernel warning
Date: Wed, 1 Dec 2021 16:51:49 +0800 [thread overview]
Message-ID: <4d9cd15b-1adf-07aa-e115-a0da75f14a9d@linux.dev> (raw)
In-Reply-To: <CAMGffEmE6789WiYbX4+XXt3ZwPCcx8AjLDDnhYJsSfb0Pu7oYg@mail.gmail.com>
On 11/30/21 7:03 PM, Jinpu Wang wrote:
> On Tue, Nov 30, 2021 at 11:40 AM Christoph Lameter<cl@gentwo.org> wrote:
>> On Sun, 28 Nov 2021, Guoqing Jiang wrote:
>>
>>> int cpu;
>>>
>>> cpu = raw_smp_processor_id();
>>> - s = this_cpu_ptr(stats->pcpu_stats);
>>> + s = get_cpu_ptr(stats->pcpu_stats);
>>> if (con->cpu != cpu) {
>>> s->cpu_migr.to++;
>>>
>>> @@ -27,14 +27,16 @@ void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con)
>>> s = per_cpu_ptr(stats->pcpu_stats, con->cpu);
>>> atomic_inc(&s->cpu_migr.from);
>>> }
>>> + put_cpu_ptr(stats->pcpu_stats);
>>> }
>>>
>>> void rtrs_clt_inc_failover_cnt(struct rtrs_clt_stats *stats)
>>> {
>>> struct rtrs_clt_stats_pcpu *s;
>>>
>>> - s = this_cpu_ptr(stats->pcpu_stats);
>>> + s = get_cpu_ptr(stats->pcpu_stats);
>>> s->rdma.failover_cnt++;
>>> + put_cpu_ptr(stats->pcpu_stats);
>> This is equivalent to
>>
>> this_cpu_inc(stats->pcpu_stats.rdma.failover_cnt);
>>
>> Which will also reduce the segment to a single cpu instruction.
> Thanks for your suggestion, Christoph.
Good suggestion!
> As the patch is already applied, I will send a new patch as suggested.
Thanks for it.
Cheers,
Guoqing
prev parent reply other threads:[~2021-12-01 8:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-28 13:35 [PATCH V2] RDMA/rtrs: Call {get,put}_cpu_ptr to silence a debug kernel warning Guoqing Jiang
2021-11-28 18:16 ` Leon Romanovsky
2021-11-29 15:08 ` Jason Gunthorpe
2021-11-30 10:40 ` Christoph Lameter
2021-11-30 11:03 ` Jinpu Wang
2021-12-01 8:51 ` Guoqing Jiang [this message]
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=4d9cd15b-1adf-07aa-e115-a0da75f14a9d@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=cl@gentwo.org \
--cc=haris.iqbal@ionos.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--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 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.