Re: [PATCH rdma-next] IB/core: Protect against concurrent access to hardware stats

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

 



On Wed, Mar 28, 2018 at 04:57:33PM -0500, Christopher Lameter wrote:
> On Tue, 27 Mar 2018, Leon Romanovsky wrote:
>
> > +
> > +	mutex_lock(&stats->lock);
> > +	msecs = jiffies_to_msecs(stats->lifespan);
> > +	mutex_unlock(&stats->lock);
> > +
> >  	return sprintf(buf, "%d\n", msecs);
>
> Yuck. Can we use atomic64_t instead of u64 there? There are already ops
> defined for these types of scalars that ensure atomicity when using a
> variety of operations. The way this is going means that one needs to be
> aware of the special nature of the u64s here and manually take locks which
> is error prone.
>
> Plus you wont need a mutex with atomc64_t.
>
> Plus it falls back to sane code on 64 bit platforms where this is not
> needed.

Christopher,

Do you mean to use get_jiffies_64() and friends?

Thanks

>
>
>
>

Attachment: signature.asc
Description: PGP signature


[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