public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz•org>
To: davem@davemloft•net
Cc: devel@openvz•org, containers@lists•osdl.org,
	ebiederm@xmission•com, kaber@trash•net, kuznet@ms2•inr.ac.ru,
	netdev@vger•kernel.org
Subject: [PATCH] rtnl_unlock cleanups
Date: Mon, 1 Oct 2007 13:51:06 +0400	[thread overview]
Message-ID: <20071001095106.GA7864@iris.sw.ru> (raw)

There is no need to process outstanding netlink user->kernel packets
during rtnl_unlock now. There is no rtnl_trylock in the rtnetlink_rcv
anymore.

Normal code path is the following:
netlink_sendmsg
   netlink_unicast
       netlink_sendskb
           skb_queue_tail
           netlink_data_ready
               rtnetlink_rcv
                   mutex_lock(&rtnl_mutex);
                   netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg);
                   mutex_unlock(&rtnl_mutex);

So, it is possible, that packets can be present in the rtnl->sk_receive_queue
during rtnl_unlock, but there is no need to process them at that moment as
rtnetlink_rcv for that packet is pending.

Signed-off-by: Denis V. Lunev <den@openvz•org>
Acked-by: Alexey Kuznetsov <kuznet@ms2•inr.ac.ru>

--- ./net/core/rtnetlink.c.rtnl2	2007-08-26 19:30:38.000000000 +0400
+++ ./net/core/rtnetlink.c	2007-10-01 13:09:03.000000000 +0400
@@ -75,8 +75,6 @@ void __rtnl_unlock(void)
 void rtnl_unlock(void)
 {
 	mutex_unlock(&rtnl_mutex);
-	if (rtnl && rtnl->sk_receive_queue.qlen)
-		rtnl->sk_data_ready(rtnl, 0);
 	netdev_run_todo();
 }
 
@@ -1319,11 +1317,9 @@ static void rtnetlink_rcv(struct sock *s
 	unsigned int qlen = 0;
 
 	do {
-		mutex_lock(&rtnl_mutex);
+		rtnl_lock();
 		qlen = netlink_run_queue(sk, qlen, &rtnetlink_rcv_msg);
-		mutex_unlock(&rtnl_mutex);
-
-		netdev_run_todo();
+		rtnl_unlock();
 	} while (qlen);
 }
 

                 reply	other threads:[~2007-10-01  9:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20071001095106.GA7864@iris.sw.ru \
    --to=den@openvz$(echo .)org \
    --cc=containers@lists$(echo .)osdl.org \
    --cc=davem@davemloft$(echo .)net \
    --cc=devel@openvz$(echo .)org \
    --cc=ebiederm@xmission$(echo .)com \
    --cc=kaber@trash$(echo .)net \
    --cc=kuznet@ms2$(echo .)inr.ac.ru \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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