lkml.org 
[lkml]   [2022]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/3] crypto: hisilicon/qm - defining the device isolation strategy
On Tue, Jun 14, 2022 at 09:24:08PM +0800, yekai(A) wrote:
> > > struct hisi_qm {
> > > enum qm_hw_ver ver;
> > > enum qm_fun_type fun_type;
> > > @@ -335,6 +341,9 @@ struct hisi_qm {
> > > struct qm_shaper_factor *factor;
> > > u32 mb_qos;
> > > u32 type_rate;
> > > + struct list_head uacce_hw_errs;
> > > + atomic_t uacce_ref; /* reference of the uacce */
> >
> > That is not how reference counts work, sorry. Please use 'struct kref'
> > for a real reference count, never roll your own.
> >
> > thanks,
> >
> > greg k-h
> > .
> >
>
> this atomic_t reference is lightweight than 'struct kref',

It's the same size, why would it be "lighter"? Why do you need it to be
lighter, what performance issue is there with a kref?

> this reference
> means whether the task is running. So would it be better to use atomic_t
> reference?

I do not know, as "running or not running" is a state, not a count or a
reference. why does this have to be atomic at all?

thanks,

greg k-h

\
 
 \ /
  Last update: 2022-06-14 15:30    [W:0.052 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site