Re: [PATCH V2] RDMA/rtrs: Call {get,put}_cpu_ptr to silence a debug kernel warning
From: Guoqing Jiang <hidden>
Date: 2021-12-01 08:52:00
On 11/30/21 7:03 PM, Jinpu Wang wrote:
On Tue, Nov 30, 2021 at 11:40 AM Christoph Lameter[off-list ref] wrote:quoted
On Sun, 28 Nov 2021, Guoqing Jiang wrote:quoted
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