From patchwork Thu Nov 30 00:07:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 842817 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uk9/D8DM"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3ynHmN6TF7z9sCZ for ; Thu, 30 Nov 2017 11:08:04 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbdK3AID (ORCPT ); Wed, 29 Nov 2017 19:08:03 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:45908 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752872AbdK3AIB (ORCPT ); Wed, 29 Nov 2017 19:08:01 -0500 Received: by mail-pf0-f196.google.com with SMTP id u19so2305597pfa.12 for ; Wed, 29 Nov 2017 16:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=r3V0Wji21VR0YXqBmJ8fDeHQYccCIPKp016ypebOToU=; b=uk9/D8DMt97OrIHY0Rb1Um9IS0qyj+vzfuX/Nyzal1kLAIUb8XL0AVuda9wn7G7bgD 6DNXTANBgEvH9ejfNcyrmcp2q0/akG4tprL9iSUau0Q9Sk61cXLLt/5KnpzL9YG5u6PM eEVd3eWFC7fAm5OV8txxl5NeVzZQ+kGld9/p7dkpLnSY9E9CC4YF+8JhK9oSLCo1lug/ EcgaeAXjDq24yyEznPr16MV6pIAsizd+anZ0JznAjlMq7YSMUcU8bGMvrR5tTWdBv+02 BBn8KvqDhm6ggbm9pBH64U9qmZy28HjitDyH+21ZEm1zRnh6bXUUirDJ/s5CHDYRTTeI SrSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=r3V0Wji21VR0YXqBmJ8fDeHQYccCIPKp016ypebOToU=; b=IJ2NOG7Dk4rYZu7YKu8kLNT3HKXBIRDgxWqHJrqV9OxqAO3XciT1IvddyzW7LNkxvY 2Mz5GM59N1FtOcJI67SreeZHzx+K0m8ZBLBMGjoPAtgfB2kIkzwZ43UTww0gwnGSimUu +AualoYYUrfW5niFCyygSEJe0pXx2YrueA+/zZDqEXQWg7pqFE/CjEhTOTN8g+1OMsvi i5NXfOrNZ9z67WN+1RXK2iJweUgoQQIUDKlL/VxPNhxxlgusRmXnKBOuo0M+X32a1CG2 SxfPVykrQgo8vd/RHV+yGW8msuXGj14JOvQ7kVR5HrqGSzrmIU/i1JE6Jd3jaMO9r5ih Xd/Q== X-Gm-Message-State: AJaThX7f66B9z0Ne+0UlcYi7icZfM9WgMrZkMHKms2Kh8mSKaGg5zw+I e1/aatcl7R8ibrCpD8KRZLPV1QcS X-Google-Smtp-Source: AGs4zMbMBBHpT6FRagER06Dqyf1tWyjcpORDa160JjkCHSH/5N0PDN9lUPYItAuwhkdGddxiSU2FLQ== X-Received: by 10.98.110.193 with SMTP id j184mr4748765pfc.187.1512000481314; Wed, 29 Nov 2017 16:08:01 -0800 (PST) Received: from tw-172-25-30-113.office.twttr.net ([8.25.197.25]) by smtp.gmail.com with ESMTPSA id r16sm4469540pgt.72.2017.11.29.16.08.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Nov 2017 16:08:00 -0800 (PST) From: Cong Wang To: netdev@vger.kernel.org Cc: eric.dumazet@gmail.com, Cong Wang , Jamal Hadi Salim , Jiri Pirko , Yotam Gigi Subject: [Patch net v2] act_sample: get rid of tcf_sample_cleanup_rcu() Date: Wed, 29 Nov 2017 16:07:51 -0800 Message-Id: <20171130000751.21929-1-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.9.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Similar to commit d7fb60b9cafb ("net_sched: get rid of tcfa_rcu"), TC actions don't need to respect RCU grace period, because it is either just detached from tc filter (standalone case) or it is removed together with tc filter (bound case) in which case RCU grace period is already respected at filter layer. Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action") Reported-by: Eric Dumazet Cc: Jamal Hadi Salim Cc: Jiri Pirko Cc: Yotam Gigi Signed-off-by: Cong Wang Reviewed-by: Eric Dumazet --- include/net/tc_act/tc_sample.h | 1 - net/sched/act_sample.c | 14 +++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h index 524cee4f4c81..01dbfea32672 100644 --- a/include/net/tc_act/tc_sample.h +++ b/include/net/tc_act/tc_sample.h @@ -14,7 +14,6 @@ struct tcf_sample { struct psample_group __rcu *psample_group; u32 psample_group_num; struct list_head tcfm_list; - struct rcu_head rcu; }; #define to_sample(a) ((struct tcf_sample *)a) diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c index 8b5abcd2f32f..9438969290a6 100644 --- a/net/sched/act_sample.c +++ b/net/sched/act_sample.c @@ -96,23 +96,16 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla, return ret; } -static void tcf_sample_cleanup_rcu(struct rcu_head *rcu) +static void tcf_sample_cleanup(struct tc_action *a, int bind) { - struct tcf_sample *s = container_of(rcu, struct tcf_sample, rcu); + struct tcf_sample *s = to_sample(a); struct psample_group *psample_group; - psample_group = rcu_dereference_protected(s->psample_group, 1); + psample_group = rtnl_dereference(s->psample_group); RCU_INIT_POINTER(s->psample_group, NULL); psample_group_put(psample_group); } -static void tcf_sample_cleanup(struct tc_action *a, int bind) -{ - struct tcf_sample *s = to_sample(a); - - call_rcu(&s->rcu, tcf_sample_cleanup_rcu); -} - static bool tcf_sample_dev_ok_push(struct net_device *dev) { switch (dev->type) { @@ -264,7 +257,6 @@ static int __init sample_init_module(void) static void __exit sample_cleanup_module(void) { - rcu_barrier(); tcf_unregister_action(&act_sample_ops, &sample_net_ops); }