On Fri, 22 Feb 2013 10:48:12 +0800 Wei Yongjun <weiyj...@gmail.com> wrote:
> From: Wei Yongjun <yongjun_...@trendmicro.com.cn> > > A spin lock is taken here so we should use GFP_NOWAIT like > other case. > > .. > > --- a/drivers/infiniband/hw/ipath/ipath_driver.c > +++ b/drivers/infiniband/hw/ipath/ipath_driver.c > @@ -204,7 +204,7 @@ static struct ipath_devdata *ipath_alloc_devdata(struct > pci_dev *pdev) > idr_preload(GFP_KERNEL); > spin_lock_irqsave(&ipath_devs_lock, flags); > > - ret = idr_alloc(&unit_table, dd, 0, 0, GFP_KERNEL); > + ret = idr_alloc(&unit_table, dd, 0, 0, GFP_NOWAIT); > if (ret < 0) { > printk(KERN_ERR IPATH_DRV_NAME > ": Could not allocate unit ID: error %d\n", -ret); I'd say we're entitled to use GFP_ATOMIC here: it will dip into page reserves and is less likely to fail. Given that this code is performing allocations under spin_lock_irqsave(), it should be using idr_preload()/idr_preload_end() (and perhaps even a repeat loop around those) to make the allocations more reliable. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html