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 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.
As the patch is already applied, I will send a new patch as suggested.
>
> >  }
> >
> >  int rtrs_clt_stats_migration_from_cnt_to_str(struct rtrs_clt_stats *stats, char *buf)
> > @@ -169,9 +171,10 @@ static inline void rtrs_clt_update_rdma_stats(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.dir[d].cnt++;
> >       s->rdma.dir[d].size_total += size;
> > +     put_cpu_ptr(stats->pcpu_stats);
> >  }
>
> Ditto
>
Regards!



[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