{"id":810845,"url":"http://patchwork.ozlabs.org/api/patches/810845/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170907042607.24413-1-xiyou.wangcong@gmail.com/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170907042607.24413-1-xiyou.wangcong@gmail.com>","list_archive_url":null,"date":"2017-09-07T04:26:06","name":"[net,v2,1/2] net_sched: get rid of tcfa_rcu","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"b4f393bef63236d5fe0112e16209cab3cbbf2972","submitter":{"id":211,"url":"http://patchwork.ozlabs.org/api/people/211/?format=json","name":"Cong Wang","email":"xiyou.wangcong@gmail.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170907042607.24413-1-xiyou.wangcong@gmail.com/mbox/","series":[{"id":1909,"url":"http://patchwork.ozlabs.org/api/series/1909/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1909","date":"2017-09-07T04:26:06","name":"[net,v2,1/2] net_sched: get rid of tcfa_rcu","version":2,"mbox":"http://patchwork.ozlabs.org/series/1909/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810845/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810845/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"VFZGLSHi\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xnnTB6QVMz9sNd\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu,  7 Sep 2017 14:26:22 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753394AbdIGE0U (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 7 Sep 2017 00:26:20 -0400","from mail-pf0-f195.google.com ([209.85.192.195]:33807 \"EHLO\n\tmail-pf0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1750742AbdIGE0R (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 7 Sep 2017 00:26:17 -0400","by mail-pf0-f195.google.com with SMTP id y68so3991095pfd.1\n\tfor <netdev@vger.kernel.org>; Wed, 06 Sep 2017 21:26:17 -0700 (PDT)","from tw-172-25-30-113.office.twttr.net ([8.25.197.25])\n\tby smtp.gmail.com with ESMTPSA id\n\ti2sm1759997pfd.21.2017.09.06.21.26.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tWed, 06 Sep 2017 21:26:16 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=OKEGvU6iY0SuCEaLL2h0fJnXxmty39ROSd+lHsn61qk=;\n\tb=VFZGLSHiAQlGBH7OY5BNIibGahk2I+rAgPqsZDoKMv52vTMNLlc86l75UB6yS+V+71\n\t99ioVQbXxQhl5WAuaoaSANQ5GKOhjXgwRxURjMNcAmD8XZYcu49d6nGpxfd4uC6EX9Mf\n\tgT6HRgb0VpR7fLg1OWzyclPjLR5oMrXlYc8nEC/y/ESbfVFSleZbqOHz6EoqXIiFIPSe\n\tsDrvzNejaFLxKsIhMiIUUUg8i45ikwXb/Mu/2U2oKhos1XF0wJpvvd1QquJo3wvHrlEz\n\tSnp2jy4E41a4pJi9N+h9MNfVX3LByF9WRHyAQnLcOojeWY1F+ebC6T9347YTZ6M4vFTW\n\t+tIA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=OKEGvU6iY0SuCEaLL2h0fJnXxmty39ROSd+lHsn61qk=;\n\tb=HMHeju3/hgba7eNuFVFEefUE/teN35VTUjuz2LH1F82XJAHS7y5t8jmNINshJC2tCI\n\tB0ciTQ1m6LFpeWm+LfFNGpckShIaHGZT3zg5MGTYauHIQehgDS3FrpSGsrSubw8O+SPL\n\tlyDwiih/AWIkbuxwy6BAcSiJL1W3SrWSwsNMnfdzCpWeLjePVnOSwPDkBl/P9q4BQit7\n\tYI11Em67YRi4+2nWOu2DOIiM37dHdU3YmRqCzvfxEaBB2itgj3rb2Mvjq687Rpr99wqw\n\tmhP28cZxF6zSNTEnCJxHe2089mtynBrWsEM7+68nGAPtbu8k2LRJHlMqCY3wK5gbj8eu\n\tw+Hg==","X-Gm-Message-State":"AHPjjUg3EBVZrKnuDH0shh7ANm3HWZNb/xbE9SP8USefzZg/eEUFUJm9\n\tqfit4GRv5aSWNSFbM1g=","X-Google-Smtp-Source":"ADKCNb5z5pGuTjq8aVmmh6HS11C2FfH/zbusx4uRecAwZIjjOtnr7cYHWSq8U6TkRub4usG0S5dUsg==","X-Received":"by 10.84.234.196 with SMTP id i4mr1591187plt.208.1504758376785; \n\tWed, 06 Sep 2017 21:26:16 -0700 (PDT)","From":"Cong Wang <xiyou.wangcong@gmail.com>","To":"netdev@vger.kernel.org","Cc":"jakub.kicinski@netronome.com, Cong Wang <xiyou.wangcong@gmail.com>,\n\tJiri Pirko <jiri@mellanox.com>, Eric Dumazet <edumazet@google.com>","Subject":"[Patch net v2 1/2] net_sched: get rid of tcfa_rcu","Date":"Wed,  6 Sep 2017 21:26:06 -0700","Message-Id":"<20170907042607.24413-1-xiyou.wangcong@gmail.com>","X-Mailer":"git-send-email 2.9.4","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"gen estimator has been rewritten in commit 1c0d32fde5bd\n(\"net_sched: gen_estimator: complete rewrite of rate estimators\"),\nthe caller is no longer needed to wait for a grace period.\nSo this patch gets rid of it.\n\nThis also completely closes a race condition between action free\npath and filter chain add/remove path for the following patch.\nBecause otherwise the nested RCU callback can't be caught by\nrcu_barrier().\n\nCc: Jiri Pirko <jiri@mellanox.com>\nCc: Eric Dumazet <edumazet@google.com>\nSigned-off-by: Cong Wang <xiyou.wangcong@gmail.com>\n---\n include/net/act_api.h |  2 --\n net/sched/act_api.c   | 12 +++---------\n 2 files changed, 3 insertions(+), 11 deletions(-)","diff":"diff --git a/include/net/act_api.h b/include/net/act_api.h\nindex 26ffd8333f50..68218a5f8e72 100644\n--- a/include/net/act_api.h\n+++ b/include/net/act_api.h\n@@ -38,7 +38,6 @@ struct tc_action {\n \tstruct gnet_stats_queue\t\ttcfa_qstats;\n \tstruct net_rate_estimator __rcu *tcfa_rate_est;\n \tspinlock_t\t\t\ttcfa_lock;\n-\tstruct rcu_head\t\t\ttcfa_rcu;\n \tstruct gnet_stats_basic_cpu __percpu *cpu_bstats;\n \tstruct gnet_stats_queue __percpu *cpu_qstats;\n \tstruct tc_cookie\t*act_cookie;\n@@ -55,7 +54,6 @@ struct tc_action {\n #define tcf_qstats\tcommon.tcfa_qstats\n #define tcf_rate_est\tcommon.tcfa_rate_est\n #define tcf_lock\tcommon.tcfa_lock\n-#define tcf_rcu\t\tcommon.tcfa_rcu\n \n static inline unsigned int tcf_hash(u32 index, unsigned int hmask)\n {\ndiff --git a/net/sched/act_api.c b/net/sched/act_api.c\nindex f2e9ed34a963..fc17d286a6a2 100644\n--- a/net/sched/act_api.c\n+++ b/net/sched/act_api.c\n@@ -53,10 +53,8 @@ static void tcf_action_goto_chain_exec(const struct tc_action *a,\n \tres->goto_tp = rcu_dereference_bh(chain->filter_chain);\n }\n \n-static void free_tcf(struct rcu_head *head)\n+static void free_tcf(struct tc_action *p)\n {\n-\tstruct tc_action *p = container_of(head, struct tc_action, tcfa_rcu);\n-\n \tfree_percpu(p->cpu_bstats);\n \tfree_percpu(p->cpu_qstats);\n \n@@ -76,11 +74,7 @@ static void tcf_hash_destroy(struct tcf_hashinfo *hinfo, struct tc_action *p)\n \thlist_del(&p->tcfa_head);\n \tspin_unlock_bh(&hinfo->lock);\n \tgen_kill_estimator(&p->tcfa_rate_est);\n-\t/*\n-\t * gen_estimator est_timer() might access p->tcfa_lock\n-\t * or bstats, wait a RCU grace period before freeing p\n-\t */\n-\tcall_rcu(&p->tcfa_rcu, free_tcf);\n+\tfree_tcf(p);\n }\n \n int __tcf_hash_release(struct tc_action *p, bool bind, bool strict)\n@@ -271,7 +265,7 @@ void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est)\n {\n \tif (est)\n \t\tgen_kill_estimator(&a->tcfa_rate_est);\n-\tcall_rcu(&a->tcfa_rcu, free_tcf);\n+\tfree_tcf(a);\n }\n EXPORT_SYMBOL(tcf_hash_cleanup);\n \n","prefixes":["net","v2","1/2"]}