netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: akpm@linux-foundation.org
Cc: davem@davemloft.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 4/7] netconsole: remove unnecessary netconsole_target_get/out() from write_msg()
Date: Thu, 14 May 2015 12:06:23 -0400	[thread overview]
Message-ID: <1431619586-29187-5-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1431619586-29187-1-git-send-email-tj@kernel.org>

write_msg() grabs target_list_lock and walks target_list invoking
netpool_send_udp() on each target.  Curiously, it protects each
iteration with netconsole_target_get/put() even though it never
releases target_list_lock which protects all the members.

While this doesn't harm anything, it doesn't serve any purpose either.
The items on the list can't go away while target_list_lock is held.
Remove the unnecessary get/put pair.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Miller <davem@davemloft.net>
---
 drivers/net/netconsole.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 15731d1..30c0524 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -744,7 +744,6 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
 
 	spin_lock_irqsave(&target_list_lock, flags);
 	list_for_each_entry(nt, &target_list, list) {
-		netconsole_target_get(nt);
 		if (nt->enabled && netif_running(nt->np.dev)) {
 			/*
 			 * We nest this inside the for-each-target loop above
@@ -760,7 +759,6 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)
 				left -= frag;
 			}
 		}
-		netconsole_target_put(nt);
 	}
 	spin_unlock_irqrestore(&target_list_lock, flags);
 }
-- 
2.1.0

  parent reply	other threads:[~2015-05-14 16:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 16:06 [PATCHSET REPOST] printk, netconsole: implement extended console support Tejun Heo
2015-05-14 16:06 ` [PATCH 1/7] printk: guard the amount written per line by devkmsg_read() Tejun Heo
2015-05-15 12:44   ` Petr Mladek
2015-05-14 16:06 ` [PATCH 2/7] printk: factor out message formatting from devkmsg_read() Tejun Heo
2015-05-15 12:45   ` Petr Mladek
2015-05-14 16:06 ` [PATCH 3/7] printk: implement support for extended console drivers Tejun Heo
2015-05-15 13:20   ` Petr Mladek
2015-05-14 16:06 ` Tejun Heo [this message]
2015-05-14 16:06 ` [PATCH 5/7] netconsole: make netconsole_target->enabled a bool Tejun Heo
2015-05-14 16:06 ` [PATCH 6/7] netconsole: make all dynamic netconsoles share a mutex Tejun Heo
2015-05-14 16:06 ` [PATCH 7/7] netconsole: implement extended console support Tejun Heo

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=1431619586-29187-5-git-send-email-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --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).