Re: [PATCH V2] RDMA/rtrs: Call {get,put}_cpu_ptr to silence a debug kernel warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/30/21 7:03 PM, Jinpu Wang wrote:
On Tue, Nov 30, 2021 at 11:40 AM Christoph Lameter<cl@xxxxxxxxxx>  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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux