[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3F128C9216C9B84BB6ED23EF16290AFB18571E3F@CRSMSX101.amr.corp.intel.com>
Date: Tue, 27 Oct 2015 18:56:50 +0000
From: "Wan, Kaike" <kaike.wan@...el.com>
To: Jason Gunthorpe <jgunthorpe@...idianresearch.com>,
"Weiny, Ira" <ira.weiny@...el.com>
CC: Saurabh Sengar <saurabh.truth@...il.com>,
"dledford@...hat.com" <dledford@...hat.com>,
"Hefty, Sean" <sean.hefty@...el.com>,
"hal.rosenstock@...il.com" <hal.rosenstock@...il.com>,
"yun.wang@...fitbricks.com" <yun.wang@...fitbricks.com>,
"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] IB/sa: replace GFP_KERNEL with GFP_ATOMIC
> -----Original Message-----
> From: Jason Gunthorpe [mailto:jgunthorpe@...idianresearch.com]
> Sent: Tuesday, October 27, 2015 2:17 PM
> To: Weiny, Ira
> Cc: Saurabh Sengar; dledford@...hat.com; Hefty, Sean;
> hal.rosenstock@...il.com; yun.wang@...fitbricks.com; Wan, Kaike; linux-
> rdma@...r.kernel.org; linux-kernel@...r.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists