Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1257129
| From | "Wan, Kaike" <kaike.wan@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC |
| Date | 2015-10-27 20:00 +0100 |
| Message-ID | <qohDs-j5-15@gated-at.bofh.it> (permalink) |
| References | <qnH6W-3es-15@gated-at.bofh.it> <qoeFB-6WP-27@gated-at.bofh.it> <qoh0J-5E-5@gated-at.bofh.it> <qoh0K-5E-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> -----Original Message----- > From: Jason Gunthorpe [mailto:jgunthorpe@obsidianresearch.com] > Sent: Tuesday, October 27, 2015 2:17 PM > To: Weiny, Ira > Cc: Saurabh Sengar; dledford@redhat.com; Hefty, Sean; > hal.rosenstock@gmail.com; yun.wang@profitbricks.com; Wan, Kaike; linux- > rdma@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC > > On Tue, Oct 27, 2015 at 02:12:36PM -0400, ira.weiny wrote: > > On Tue, Oct 27, 2015 at 09:17:40PM +0530, Saurabh Sengar wrote: > > > replace GFP_KERNEL with GFP_ATOMIC, as code while holding a spinlock > > > should be atomic GFP_KERNEL may sleep and can cause deadlock, where > > > as GFP_ATOMIC may fail but certainly avoids deadlock > > > > Great catch. Thanks! > > > > However, gfp_t is passed to send_mad and we should pass that down and > use it. > > > spin_lock_irqsave(&ib_nl_request_lock, flags); > > - ret = ib_nl_send_msg(query); > > + ret = ib_nl_send_msg(query, gfp_mask); > > A spin lock is guarenteed held around ib_nl_send_msg, so it's allocations > have to be atomic, can't use gfp_mask here.. > > I do wonder if it is a good idea to call ib_nl_send_msg with a spinlock held > though.. Would be nice to see that go away. We have to hold the lock to protect against a race condition that a quick response will try to free the request from the ib_nl_request_list before we even put it on the list. > > Jason -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC Saurabh Sengar <saurabh.truth@gmail.com> - 2015-10-27 16:50 +0100
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC "ira.weiny" <ira.weiny@intel.com> - 2015-10-27 19:20 +0100
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2015-10-27 19:20 +0100
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC "ira.weiny" <ira.weiny@intel.com> - 2015-10-27 19:30 +0100
RE: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC "Wan, Kaike" <kaike.wan@intel.com> - 2015-10-27 20:00 +0100
Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2015-10-27 21:10 +0100
RE: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC "Weiny, Ira" <ira.weiny@intel.com> - 2015-10-28 05:40 +0100
csiph-web