On Thu, Sep 20, 2018 at 12:36 AM Vlad Buslov <vla...@mellanox.com> wrote:
>
>
> On Wed 19 Sep 2018 at 22:09, Cong Wang <xiyou.wangc...@gmail.com> wrote:
> > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov <vla...@mellanox.com> wrote:
> >> @@ -482,16 +483,25 @@ static int tcf_block_insert(struct tcf_block *block, 
> >> struct net *net,
> >>                             struct netlink_ext_ack *extack)
> >>  {
> >>         struct tcf_net *tn = net_generic(net, tcf_net_id);
> >> +       int err;
> >> +
> >> +       idr_preload(GFP_KERNEL);
> >> +       spin_lock(&tn->idr_lock);
> >> +       err = idr_alloc_u32(&tn->idr, block, &block->index, block->index,
> >> +                           GFP_NOWAIT);
> >
> >
> > Why GFP_NOWAIT rather than GFP_ATOMIC here?
>
> I checked how idr_preload is used in kernel and in most places following
> allocation uses GFP_NOWAIT (including idr-test.c). You suggest I should
> change it to GFP_ATOMIC?

No, I am just curious, as GFP_ATOMIC is more widely used when holding
spinlock. I thought you have a special reason to use GFP_NOWAIT here,
but anyway, GFP_NOWAIT is probably fine too.

Reply via email to