浏览代码

pfifo_fast: drop unneeded additional lock on dequeue

After the previous patch, for NOLOCK qdiscs, q->seqlock is
always held when the dequeue() is invoked, we can drop
any additional locking to protect such operation.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Paolo Abeni 7 年之前
父节点
当前提交
021a17ed79
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 5 0
      include/linux/skb_array.h
  2. 2 2
      net/sched/sch_generic.c

+ 5 - 0
include/linux/skb_array.h

@@ -97,6 +97,11 @@ static inline bool skb_array_empty_any(struct skb_array *a)
 	return ptr_ring_empty_any(&a->ring);
 	return ptr_ring_empty_any(&a->ring);
 }
 }
 
 
+static inline struct sk_buff *__skb_array_consume(struct skb_array *a)
+{
+	return __ptr_ring_consume(&a->ring);
+}
+
 static inline struct sk_buff *skb_array_consume(struct skb_array *a)
 static inline struct sk_buff *skb_array_consume(struct skb_array *a)
 {
 {
 	return ptr_ring_consume(&a->ring);
 	return ptr_ring_consume(&a->ring);

+ 2 - 2
net/sched/sch_generic.c

@@ -656,7 +656,7 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
 		if (__skb_array_empty(q))
 		if (__skb_array_empty(q))
 			continue;
 			continue;
 
 
-		skb = skb_array_consume_bh(q);
+		skb = __skb_array_consume(q);
 	}
 	}
 	if (likely(skb)) {
 	if (likely(skb)) {
 		qdisc_qstats_cpu_backlog_dec(qdisc, skb);
 		qdisc_qstats_cpu_backlog_dec(qdisc, skb);
@@ -697,7 +697,7 @@ static void pfifo_fast_reset(struct Qdisc *qdisc)
 		if (!q->ring.queue)
 		if (!q->ring.queue)
 			continue;
 			continue;
 
 
-		while ((skb = skb_array_consume_bh(q)) != NULL)
+		while ((skb = __skb_array_consume(q)) != NULL)
 			kfree_skb(skb);
 			kfree_skb(skb);
 	}
 	}