Re: [PATCH 2/4] cdc-acm: Convert acm_minors to XArray

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

 



On Di, 2019-03-19 at 13:14 +0100, Greg KH wrote:
> On Mon, Mar 18, 2019 at 02:17:11PM -0700, Matthew Wilcox wrote:
> > Signed-off-by: Matthew Wilcox <willy@xxxxxxxxxxxxx>

[..]
> >  static int acm_alloc_minor(struct acm *acm)
> >  {
> > -	int minor;
> > -
> > -	mutex_lock(&acm_minors_lock);
> > -	minor = idr_alloc(&acm_minors, acm, 0, ACM_TTY_MINORS, GFP_KERNEL);
> > -	mutex_unlock(&acm_minors_lock);
> > -
> > -	return minor;
> > +	return xa_alloc(&acm_minors, &acm->minor, acm,
> > +			XA_LIMIT(0, ACM_TTY_MINORS - 1), GFP_KERNEL);
> 
> So, the only thing "better" here is that you don't need a lock anymore?

Once this is accepted I can reduce the locking to a per instance
spinlock. But to start with a straight conversion is best.

	Regards
		Oliver




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux