OpenVZ Forum


Home » Mailing lists » Devel » [PATCH 1/5] rtnl_unlock cleanups
[PATCH 1/5] rtnl_unlock cleanups [message #21347] Fri, 05 October 2007 14:43 Go to next message
den is currently offline  den
Messages: 494
Registered: December 2005
Senior Member
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);
 }
Re: [PATCH 1/5] rtnl_unlock cleanups [message #21561 is a reply to message #21347] Thu, 11 October 2007 04:13 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: "Denis V. Lunev" <den@openvz.org>
Date: Fri, 5 Oct 2007 18:44:14 +0400

> 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>

Applied.
Previous Topic: Idle time statistics for a container
Next Topic: [PATCH 3/5] cleanup 3rd argument in netlink_sendskb
Goto Forum:
  


Current Time: Mon Oct 14 16:26:44 GMT 2024

Total time taken to generate the page: 0.05525 seconds