From: Cong Wang <xiyou.wangcong@gmail.com>
To: Vlad Buslov <vladbu@mellanox.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>, David Miller <davem@davemloft.net>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Kirill Tkhai <ktkhai@virtuozzo.com>,
	Nicolas Dichtel <nicolas.dichtel@6wind.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	mark.rutland@arm.com, Leon Romanovsky <leon@kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Florian Westphal <fw@strlen.de>, David Ahern <dsahern@gmail.com>,
	christian@brauner.io, lucien xin <lucien.xin@gmail.com>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Jiri Benc <jbenc@redhat.com>
Subject: Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock
Date: Fri, 21 Sep 2018 12:33:15 -0700	[thread overview]
Message-ID: <CAM_iQpUr8GLdwZ_0P_RBcPD0iGHXxC4C68RzTy3Sc2idaJZJRg@mail.gmail.com> (raw)
In-Reply-To: <vbftvmkzkln.fsf@reg-r-vrt-018-180.mtr.labs.mlnx>
On Thu, Sep 20, 2018 at 12:36 AM Vlad Buslov <vladbu@mellanox.com> wrote:
>
>
> On Wed 19 Sep 2018 at 22:09, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov <vladbu@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.
next prev parent reply	other threads:[~2018-09-22  1:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17  7:17 [PATCH net-next v2 00/10] Refactor classifier API to work with Qdisc/blocks without rtnl lock Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 01/10] net: core: netlink: add helper refcount dec and lock function Vlad Buslov
2018-09-19 21:46   ` Cong Wang
2018-09-17  7:17 ` [PATCH net-next v2 02/10] net: sched: rename qdisc_destroy() to qdisc_put() Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 03/10] net: sched: extend Qdisc with rcu Vlad Buslov
2018-09-19  2:45   ` David Miller
2018-09-17  7:17 ` [PATCH net-next v2 04/10] net: sched: add helper function to take reference to Qdisc Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 05/10] net: sched: use Qdisc rcu API instead of relying on rtnl lock Vlad Buslov
2018-09-19 22:04   ` Cong Wang
2018-09-20  7:20     ` Vlad Buslov
2018-09-21 19:29       ` Cong Wang
2018-09-17  7:17 ` [PATCH net-next v2 06/10] net: sched: change tcf block reference counter type to refcount_t Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 07/10] net: sched: implement functions to put and flush all chains Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock Vlad Buslov
2018-09-19 22:09   ` Cong Wang
2018-09-20  7:36     ` Vlad Buslov
2018-09-21 19:33       ` Cong Wang [this message]
2018-09-17  7:17 ` [PATCH net-next v2 09/10] net: sched: implement tcf_block_refcnt_{get|put}() Vlad Buslov
2018-09-17  7:17 ` [PATCH net-next v2 10/10] net: sched: use reference counting for tcf blocks on rules update Vlad Buslov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox
  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):
  git send-email \
    --in-reply-to=CAM_iQpUr8GLdwZ_0P_RBcPD0iGHXxC4C68RzTy3Sc2idaJZJRg@mail.gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=christian@brauner.io \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=fw@strlen.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jakub.kicinski@netronome.com \
    --cc=jbenc@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=ktkhai@virtuozzo.com \
    --cc=leon@kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=stephen@networkplumber.org \
    --cc=vladbu@mellanox.com \
    /path/to/YOUR_REPLY
  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
  Be sure your reply has a Subject: header at the top and a blank line
  before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).