From: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
To: Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
infinipath-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH -next v3] IB/ipath: use GFP_NOWAIT under spin lock
Date: Fri, 22 Feb 2013 14:16:42 -0800 [thread overview]
Message-ID: <20130222141642.247ee792.akpm@linux-foundation.org> (raw)
In-Reply-To: <CAPgLHd8_WyQiDpJwRWwNVPbSvVcpMj1bMu7h2QmfJpscd0LOFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Fri, 22 Feb 2013 10:48:12 +0800
Wei Yongjun <weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> From: Wei Yongjun <yongjun_wei-zrsr2BFq86L20UzCJQGyNP8+0UxHXcjY@public.gmane.org>
>
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-02-22 22:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-21 5:45 [PATCH -next v2] IB/ipath: use GFP_NOWAIT under spin lock Wei Yongjun
[not found] ` <CAPgLHd965-++Kj6HE-wjHqpZjortmmCAvApSSwiXaX6YwWncHQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-21 14:34 ` Marciniszyn, Mike
2013-02-21 15:33 ` Tejun Heo
[not found] ` <CAOS58YNcJ0gDmoR4M1tgJbqqzv0i=5EkoAr=OhoTSrozfw-ZtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-21 15:34 ` Tejun Heo
[not found] ` <CAOS58YOHt7OaBHRwwqjLF8xZtVaj=BeFUXFAxW0owb4_BxC3Rg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-22 2:48 ` [PATCH -next v3] " Wei Yongjun
[not found] ` <CAPgLHd8_WyQiDpJwRWwNVPbSvVcpMj1bMu7h2QmfJpscd0LOFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-22 22:16 ` Andrew Morton [this message]
[not found] ` <20130222141642.247ee792.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2013-02-22 22:21 ` Tejun Heo
[not found] ` <CAOS58YMrcCwh8RhnfRTsmbfa_K_h1=n2M6ws4=MHWDxpAAoXOw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-22 22:44 ` Andrew Morton
[not found] ` <20130222144451.ed48f015.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2013-02-22 22:51 ` Tejun Heo
[not found] ` <CAOS58YMo3rABCLpKYRr7pRqeMo+rmGbbUJDj5xxE08pb-SyBqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-22 22:58 ` Tejun Heo
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=20130222141642.247ee792.akpm@linux-foundation.org \
--to=akpm-de/tnxtf+jlsfhdxvbkv3wd2fqjk+8+b@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=infinipath-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=weiyj.lk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.