From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vlad Buslov Subject: Re: [PATCH net-next v2 08/10] net: sched: protect block idr with spinlock Date: Thu, 20 Sep 2018 10:36:20 +0300 Message-ID: References: <1537168660-24032-1-git-send-email-vladbu@mellanox.com> <1537168660-24032-9-git-send-email-vladbu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Linux Kernel Network Developers , Jamal Hadi Salim , Jiri Pirko , David Miller , Stephen Hemminger , Kirill Tkhai , Nicolas Dichtel , Greg KH , mark.rutland@arm.com, Leon Romanovsky , "Paul E. McKenney" , Florian Westphal , David Ahern , christian@brauner.io, lucien xin , Jakub Kicinski , Jiri Benc To: Cong Wang Return-path: Received: from mail-eopbgr50043.outbound.protection.outlook.com ([40.107.5.43]:27072 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726177AbeITNSh (ORCPT ); Thu, 20 Sep 2018 09:18:37 -0400 In-reply-to: Sender: netdev-owner@vger.kernel.org List-ID: On Wed 19 Sep 2018 at 22:09, Cong Wang wrote: > On Mon, Sep 17, 2018 at 12:19 AM Vlad Buslov 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?