[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM_iQpUr8GLdwZ_0P_RBcPD0iGHXxC4C68RzTy3Sc2idaJZJRg@mail.gmail.com>
Date: Fri, 21 Sep 2018 12:33:15 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: Vlad Buslov <vladbu@...lanox.com>
Cc: Linux Kernel Network Developers <netdev@...r.kernel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Jiri Pirko <jiri@...nulli.us>,
David Miller <davem@...emloft.net>,
Stephen Hemminger <stephen@...workplumber.org>,
Kirill Tkhai <ktkhai@...tuozzo.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Greg KH <gregkh@...uxfoundation.org>, mark.rutland@....com,
Leon Romanovsky <leon@...nel.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Florian Westphal <fw@...len.de>,
David Ahern <dsahern@...il.com>, christian@...uner.io,
lucien xin <lucien.xin@...il.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Jiri Benc <jbenc@...hat.com>
Subject: Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock
On Thu, Sep 20, 2018 at 12:36 AM Vlad Buslov <vladbu@...lanox.com> wrote:
>
>
> On Wed 19 Sep 2018 at 22:09, Cong Wang <xiyou.wangcong@...il.com> wrote:
> > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov <vladbu@...lanox.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.
Powered by blists - more mailing lists