diff mbox

[net-next] xfrm: move the checking for old xfrm_policy hold_queue to beginning

Message ID 1430385919-22030-1-git-send-email-roy.qing.li@gmail.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Li RongQing April 30, 2015, 9:25 a.m. UTC
From: Li RongQing <roy.qing.li@gmail.com>

if hold_queue of old xfrm_policy is NULL, return directly, then not need to
run other codes, especially take the spin lock

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
---
 net/xfrm/xfrm_policy.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Steffen Klassert May 5, 2015, 11:41 a.m. UTC | #1
On Thu, Apr 30, 2015 at 05:25:19PM +0800, roy.qing.li@gmail.com wrote:
> From: Li RongQing <roy.qing.li@gmail.com>
> 
> if hold_queue of old xfrm_policy is NULL, return directly, then not need to
> run other codes, especially take the spin lock
> 
> Signed-off-by: Li RongQing <roy.qing.li@gmail.com>

Also applied to ipsec-next, thanks a lot!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index f576217..1d53f4d 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -708,6 +708,9 @@  static void xfrm_policy_requeue(struct xfrm_policy *old,
 	struct xfrm_policy_queue *pq = &old->polq;
 	struct sk_buff_head list;
 
+	if (skb_queue_empty(&pq->hold_queue))
+		return;
+
 	__skb_queue_head_init(&list);
 
 	spin_lock_bh(&pq->hold_queue.lock);
@@ -716,9 +719,6 @@  static void xfrm_policy_requeue(struct xfrm_policy *old,
 		xfrm_pol_put(old);
 	spin_unlock_bh(&pq->hold_queue.lock);
 
-	if (skb_queue_empty(&list))
-		return;
-
 	pq = &new->polq;
 
 	spin_lock_bh(&pq->hold_queue.lock);