From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752822Ab1GUIfS (ORCPT ); Thu, 21 Jul 2011 04:35:18 -0400 Received: from mail-ey0-f171.google.com ([209.85.215.171]:49394 "EHLO mail-ey0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546Ab1GUIfG (ORCPT ); Thu, 21 Jul 2011 04:35:06 -0400 Date: Thu, 21 Jul 2011 10:35:01 +0200 From: Tejun Heo To: Rusty Russell Cc: Jonathan Cameron , LKML , Andrew Morton Subject: Re: RFC: Boiler plate functions for ida / idr allocation? Message-ID: <20110721083501.GC3455@htj.dyndns.org> References: <4E1D6900.6040500@cam.ac.uk> <20110713133139.GO2872@htj.dyndns.org> <4E1DA232.30408@cam.ac.uk> <878vrs2if3.fsf@rustcorp.com.au> <20110721081946.GB3455@htj.dyndns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110721081946.GB3455@htj.dyndns.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 21, 2011 at 10:19:46AM +0200, Tejun Heo wrote: > On Thu, Jul 21, 2011 at 05:07:36PM +0930, Rusty Russell wrote: > > From: Rusty Russell > > Subject: ida: Simplified functions for id allocation. > > > > The current hyper-optimized functions are overkill if you simply want > > to allocate an id for a device. Create versions which use an internal > > lock. > > > > Thanks to Tejun for feedback. Feel free to delete the #ifdef TEST > > code. > > > > Signed-off-by: Rusty Russell > ... > > static struct kmem_cache *idr_layer_cache; > > +static DEFINE_SPINLOCK(simple_ida); > > I think the name is a bit confusing. Maybe simple_ida_lock is better? > Other than that, Ooh, one more thing, maybe it would be better to use spin_lock_irq() to allow calling free under other irq locks. Thanks. -- tejun