linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.com>
To: Greg KH <greg@kroah.com>, Matthew Wilcox <willy@infradead.org>
Cc: linux-usb@vger.kernel.org
Subject: [2/4] cdc-acm: Convert acm_minors to XArray
Date: Tue, 19 Mar 2019 13:41:16 +0100	[thread overview]
Message-ID: <1552999276.14757.45.camel@suse.com> (raw)

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@infradead.org>

[..]
> >  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

             reply	other threads:[~2019-03-19 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 12:41 Oliver Neukum [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-03-19 13:29 [2/4] cdc-acm: Convert acm_minors to XArray Matthew Wilcox
2019-03-19 12:39 Oliver Neukum
2019-03-19 12:14 Greg KH
2019-03-18 21:17 Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1552999276.14757.45.camel@suse.com \
    --to=oneukum@suse.com \
    --cc=greg@kroah.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).