On 16-07-13 11:19 PM, John Fastabend wrote:
> This patch adds a flag for queueing disciplines to indicate the stack
> does not need to use the qdisc lock to protect operations. This can
> be used to build lockless scheduling algorithms and improving
> performance.
>
> The flag is checked in the tx path and the qdisc lock is only taken
> if it is not set. For now use a conditional if statement. Later we
> could be more aggressive if it proves worthwhile and use a static key
> or wrap this in a likely().
>
> Signed-off-by: John Fastabend <[email protected]>
> ---
[...]
> @@ -3075,6 +3075,27 @@ static inline int __dev_xmit_skb(struct sk_buff *skb,
> struct Qdisc *q,
> int rc;
>
> qdisc_calculate_pkt_len(skb, q);
> +
> + if (q->flags & TCQ_F_NOLOCK) {
> + if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) {
> + __qdisc_drop(skb, &to_free);
> + rc = NET_XMIT_DROP;
> + } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q)) {
> + qdisc_bstats_cpu_update(q, skb);
> + __qdisc_run(q);
Reviewing these patches now and noticed this qdisc_run() is not
needed.
> + if (sch_direct_xmit(skb, q, dev, txq, root_lock, true))
> + __qdisc_run(q);
> + rc = NET_XMIT_SUCCESS;
> + } else {
> + rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
> + __qdisc_run(q);
> + }
> +
> + if (unlikely(to_free))
> + kfree_skb_list(to_free);
> + return rc;
> + }
> +
[...]
Thanks,
John