lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1442342322.2177.13.camel@HansenPartnership.com>
Date:	Tue, 15 Sep 2015 11:38:42 -0700
From:	James Bottomley <James.Bottomley@...senPartnership.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Lee Duncan <lduncan@...e.com>, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org, Hannes Reinecke <hare@...e.com>,
	Johannes Thumshirn <jthumshirn@...e.de>,
	Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH 01/17] Add ida and idr helper routines.

On Tue, 2015-09-15 at 14:27 -0400, Tejun Heo wrote:
> Hello,
> 
> On Tue, Sep 15, 2015 at 09:46:01AM -0700, Lee Duncan wrote:
> > +/**
> > + * ida_get_index - allocate a ida index value
> > + * @ida		idr handle
> > + * @lock	spinlock handle protecting this index
> > + * @p_id	pointer to allocated index value
> > + *
> > + * A helper function for safely allocating an index value (id),
> > + * returning a negative errno value on failure, else 0.
> > + */
> > +static inline int ida_get_index(struct ida *ida, spinlock_t *lock, int *p_id)
> > +{
> > +	int error = -ENOMEM;
> > +
> > +	do {
> > +		if (!ida_pre_get(ida, GFP_KERNEL))
> > +			break;
> > +		spin_lock(lock);
> > +		error = ida_get_new(ida, p_id);
> > +		spin_unlock(lock);
> > +	} while (error == -EAGAIN);
> > +
> > +	return error;
> > +}
> 
> Obviously ida allocation doesn't need to be synchronized against
> anything else.  Why not just use ida_simple_get/remove()?

For most of the SCSI stuff, yes.  I'm less sure about the sd numbers.
They go up very high and get hammered a lot during system bring up and
hot plug.  I think having their own lock rather than wrapping everything
around simple_ida_lock makes more sense here just because the system is
heavily contended on getting indexes at bring up.

To continue the thought, why not move simple_ida_lock into struct ida so
we don't have to worry about the contention and can sue ida_simple_...
everywhere?

James



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ