Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1257115

Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC

From "ira.weiny" <ira.weiny@intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC
Date 2015-10-27 19:30 +0100
Message-ID <qohap-8R-13@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

Show all headers | View raw


On Tue, Oct 27, 2015 at 12:16:52PM -0600, Jason Gunthorpe wrote:
> 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.

Ah, yea my bad.

Ira

> 
> 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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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