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