From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, ebiederm@xmission.com
Subject: [PATCH net-next-2.6] netns: call ops_free right after ops_exit
Date: Sun, 25 Apr 2010 11:26:01 +0200 [thread overview]
Message-ID: <20100425092600.GB2866@psychotron.redhat.com> (raw)
There's no need to iterate this twice. We can free net generic variables right
after exit is called.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index bd8c471..16217bc 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -82,7 +82,7 @@ static void ops_free_list(const struct pernet_operations *ops,
static __net_init int setup_net(struct net *net)
{
/* Must be called with net_mutex held */
- const struct pernet_operations *ops, *saved_ops;
+ const struct pernet_operations *ops;
int error = 0;
LIST_HEAD(net_exit_list);
@@ -105,13 +105,10 @@ out_undo:
* for the pernet modules whose init functions did not fail.
*/
list_add(&net->exit_list, &net_exit_list);
- saved_ops = ops;
- list_for_each_entry_continue_reverse(ops, &pernet_list, list)
+ list_for_each_entry_continue_reverse(ops, &pernet_list, list) {
ops_exit_list(ops, &net_exit_list);
-
- ops = saved_ops;
- list_for_each_entry_continue_reverse(ops, &pernet_list, list)
ops_free_list(ops, &net_exit_list);
+ }
rcu_barrier();
goto out;
@@ -231,13 +228,14 @@ static void cleanup_net(struct work_struct *work)
*/
synchronize_rcu();
- /* Run all of the network namespace exit methods */
- list_for_each_entry_reverse(ops, &pernet_list, list)
+ /*
+ * Run all of the network namespace exit methods and free
+ * the net generic variables
+ */
+ list_for_each_entry_reverse(ops, &pernet_list, list) {
ops_exit_list(ops, &net_exit_list);
-
- /* Free the net generic variables */
- list_for_each_entry_reverse(ops, &pernet_list, list)
ops_free_list(ops, &net_exit_list);
+ }
mutex_unlock(&net_mutex);
next reply other threads:[~2010-04-25 9:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-25 9:26 Jiri Pirko [this message]
2010-04-25 9:59 ` [PATCH net-next-2.6] netns: call ops_free right after ops_exit David Miller
2010-04-25 14:50 ` Eric W. Biederman
2010-04-25 18:44 ` Jiri Pirko
2010-04-26 3:06 ` Eric W. Biederman
2010-04-26 10:43 ` Jiri Pirko
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=20100425092600.GB2866@psychotron.redhat.com \
--to=jpirko@redhat.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.org \
/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).