netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][net-next] xfrm: move the checking for old xfrm_policy hold_queue to beginning
@ 2015-04-30  9:25 roy.qing.li
  2015-05-05 11:41 ` Steffen Klassert
  0 siblings, 1 reply; 2+ messages in thread
From: roy.qing.li @ 2015-04-30  9:25 UTC (permalink / raw)
  To: netdev; +Cc: steffen.klassert

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

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);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][net-next] xfrm: move the checking for old xfrm_policy hold_queue to beginning
  2015-04-30  9:25 [PATCH][net-next] xfrm: move the checking for old xfrm_policy hold_queue to beginning roy.qing.li
@ 2015-05-05 11:41 ` Steffen Klassert
  0 siblings, 0 replies; 2+ messages in thread
From: Steffen Klassert @ 2015-05-05 11:41 UTC (permalink / raw)
  To: roy.qing.li; +Cc: netdev

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!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-05 11:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-30  9:25 [PATCH][net-next] xfrm: move the checking for old xfrm_policy hold_queue to beginning roy.qing.li
2015-05-05 11:41 ` Steffen Klassert

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