Skip to contentSkip to conversation

Avoid enqueuing skb for default qdiscs

RFC PATCH Krishna Kumar2 4 participants 7 messages Aug 2, 2009 – Aug 4, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Krishna Kumar2/India/IBM@IBMIN wrote on 07/28/2009 09:20:55 PM:

Quoted 4 lines

Subject [RFC] [PATCH] Avoid enqueuing skb for default qdiscs

From: Krishna Kumar <[email protected]>

Quoted 8 lines

dev_queue_xmit enqueue's a skb and calls qdisc_run which dequeue's the skb and xmits it. In most cases (after instrumenting the code), the skb that is enqueue'd is the same one that is dequeue'd (unless the queue gets stopped or multiple cpu's write to the same queue and ends in a race with qdisc_run). For default qdiscs, we can remove this path and simply xmit the skb since this is a work conserving queue.

Any comments on this patch?

Thanks,

- KK

Quoted 34 lines

The patch uses a new flag - TCQ_F_CAN_BYPASS to identify the default fast queue. I plan to use this flag for the previous patch also (rename if required). The controversial part of the patch is incrementing qlen when a skb is requeued, this is to avoid checks like the second line below:

+ } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) &&

Quoted 1 line
Quoted 1 line

THIS LINE: !q->gso_skb &&

+ !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) {

Results of a 4 hour testing for multiple netperf sessions (1, 2, 4, 8, 12 sessions on a 4 cpu system-X and 1, 2, 4, 8, 16, 32 sessions on a 16 cpu P6). Aggregate Mb/s across the iterations:

-----------------------------------------------------------------
| System-X | P6
-----------------------------------------------------------------

Size |  ORG BW          NEW BW   |      ORG BW          NEW BW
-----|---------------------------|-------------------------------
16K  |  154264          156234   |      155350          157569
64K  |  154364          154825   |      155790          158845
128K |  154644          154803   |      153418          155572
256K |  153882          152007   |      154784          154596

-----------------------------------------------------------------

Netperf reported Service demand reduced by 15% on the P6 but no noticeable difference on the system-X box.

Please review.

Thanks,

- KK

#2 lore raw
Quoted 15 lines · On Sun, Aug 02, 2009 at 02:21:30PM +0530, Krishna Kumar2 wrote:

Krishna Kumar2/India/IBM@IBMIN wrote on 07/28/2009 09:20:55 PM:

Quoted 4 lines

Subject [RFC] [PATCH] Avoid enqueuing skb for default qdiscs

From: Krishna Kumar <[email protected]>

Quoted 8 lines

dev_queue_xmit enqueue's a skb and calls qdisc_run which dequeue's the skb and xmits it. In most cases (after instrumenting the code), the skb that is enqueue'd is the same one that is dequeue'd (unless the queue gets stopped or multiple cpu's write to the same queue and ends in a race with qdisc_run). For default qdiscs, we can remove this path and simply xmit the skb since this is a work conserving queue.

Quoted 1 line

Any comments on this patch?

Maybe I missed something, but I didn't get this patch, and can't see it e.g. in the patchwork.

Jarek P.

Quoted 39 lines

Thanks,

- KK

Quoted 34 lines

The patch uses a new flag - TCQ_F_CAN_BYPASS to identify the default fast queue. I plan to use this flag for the previous patch also (rename if required). The controversial part of the patch is incrementing qlen when a skb is requeued, this is to avoid checks like the second line below:

+ } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) &&

Quoted 1 line
Quoted 1 line

THIS LINE: !q->gso_skb &&

+ !test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) {

Results of a 4 hour testing for multiple netperf sessions (1, 2, 4, 8, 12 sessions on a 4 cpu system-X and 1, 2, 4, 8, 16, 32 sessions on a 16 cpu P6). Aggregate Mb/s across the iterations:

-----------------------------------------------------------------
| System-X | P6
-----------------------------------------------------------------

Size |  ORG BW          NEW BW   |      ORG BW          NEW BW
-----|---------------------------|-------------------------------
16K  |  154264          156234   |      155350          157569
64K  |  154364          154825   |      155790          158845
128K |  154644          154803   |      153418          155572
256K |  153882          152007   |      154784          154596

-----------------------------------------------------------------

Netperf reported Service demand reduced by 15% on the P6 but no noticeable difference on the system-X box.

Please review.

Thanks,

- KK

#3 lore raw

Jarek Poplawski <[email protected]> wrote on 08/03/2009 12:45:39 PM:

Quoted 6 lines
Quoted 1 line

Any comments on this patch?

Maybe I missed something, but I didn't get this patch, and can't see it e.g. in the patchwork.

Jarek P.

That is strange, I too do not find it :) But after I sent the patch, I got a copy of the mail which says:

Krishna
Kumar2/India/IBM@
IBMIN To
[email protected]
07/28/2009 09:20 cc
PM Krishna Kumar2/India/IBM@IBMIN,
[email protected], [email protected], [email protected], [email protected]
Subject
[RFC] [PATCH] Avoid enqueuing skb for default qdiscs

I will try to send it out once again. Thanks for letting me know.

thanks,

- KK

maintainer
#4 lore raw
In reply to Krishna Kumar2

From: Krishna Kumar2 <[email protected]>
Date: Sun, 2 Aug 2009 14:21:30 +0530

Quoted 15 lines

Krishna Kumar2/India/IBM@IBMIN wrote on 07/28/2009 09:20:55 PM:

Quoted 4 lines

Subject [RFC] [PATCH] Avoid enqueuing skb for default qdiscs

From: Krishna Kumar <[email protected]>

Quoted 8 lines

dev_queue_xmit enqueue's a skb and calls qdisc_run which dequeue's the skb and xmits it. In most cases (after instrumenting the code), the skb that is enqueue'd is the same one that is dequeue'd (unless the queue gets stopped or multiple cpu's write to the same queue and ends in a race with qdisc_run). For default qdiscs, we can remove this path and simply xmit the skb since this is a work conserving queue.

Quoted 1 line

Any comments on this patch?

Although PFIFO is not work-conserving, isn't it important to retain ordering? What if higher priority packets are in the queue when we enqueue? This new bypass will send the wrong packet, won't it?

I'm beginning to think, if we want to make the default case go as fast as possible, we should just bypass everything altogether. The entire qdisc layer, all of it.

Special casing something that essentially is unused, is in a way a waste of time. If this bypass could be applied to some of the complicated qdiscs, then it'd be worthwhile, but just for the default which effectively makes it do nothing, I don't see that value in it.

#5 lore raw
Quoted 4 lines · David Miller

Although PFIFO is not work-conserving, isn't it important to retain ordering? What if higher priority packets are in the queue when we enqueue? This new bypass will send the wrong packet, won't it?

The bypass only kicks in if the queue length is zero.

Quoted 3 lines

I'm beginning to think, if we want to make the default case go as fast as possible, we should just bypass everything altogether. The entire qdisc layer, all of it.

Can you be more specific? AFAICS he's already bypassing the qdisc layer when it can be done safely.

Quoted 5 lines

Special casing something that essentially is unused, is in a way a waste of time. If this bypass could be applied to some of the complicated qdiscs, then it'd be worthwhile, but just for the default which effectively makes it do nothing, I don't see that value in it.

I agree with this sentiment. Essentially what this bypass does is to eliminate the enqueue + qdisc_restart + dequeue in the cases where it is safe. So its value is entirely dependent on the cost of the code that is eliminated, which may not be that large for the default qdisc.

Krishna, those netperf tests that you performed, were they done with a single TX queue or multiple TX queues? If the latter did you tune the system so that each netperf was bound to a single core which had its own dedicated TX queue?

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#6 lore raw

From: Herbert Xu <[email protected]>
Date: Tue, 4 Aug 2009 11:49:10 +0800

Quoted 7 lines · David Miller
Quoted 4 lines

Although PFIFO is not work-conserving, isn't it important to retain ordering? What if higher priority packets are in the queue when we enqueue? This new bypass will send the wrong packet, won't it?

The bypass only kicks in if the queue length is zero.

Thanks for explaining, makes sense now.

Quoted 6 lines
Quoted 3 lines

I'm beginning to think, if we want to make the default case go as fast as possible, we should just bypass everything altogether. The entire qdisc layer, all of it.

Can you be more specific? AFAICS he's already bypassing the qdisc layer when it can be done safely.

Ignore this, it's based upon my missing the part where this bypass only triggers when the qdisc is empty.

#7 lore raw
In reply to Herbert Xu

Hi Herbert,

Herbert Xu <[email protected]> wrote on 08/04/2009 09:19:10 AM:

Quoted 27 lines · David Miller
Quoted 4 lines

Although PFIFO is not work-conserving, isn't it important to retain ordering? What if higher priority packets are in the queue when we enqueue? This new bypass will send the wrong packet, won't it?

The bypass only kicks in if the queue length is zero.

Quoted 3 lines

I'm beginning to think, if we want to make the default case go as fast as possible, we should just bypass everything altogether. The entire qdisc layer, all of it.

Can you be more specific? AFAICS he's already bypassing the qdisc layer when it can be done safely.

Quoted 5 lines

Special casing something that essentially is unused, is in a way a waste of time. If this bypass could be applied to some of the complicated qdiscs, then it'd be worthwhile, but just for the default which effectively makes it do nothing, I don't see that value in it.

I agree with this sentiment. Essentially what this bypass does is to eliminate the enqueue + qdisc_restart + dequeue in the cases where it is safe. So its value is entirely dependent on the cost of the code that is eliminated, which may not be that large for the default qdisc.

Quoted 4 lines

Krishna, those netperf tests that you performed, were they done with a single TX queue or multiple TX queues? If the latter did you tune the system so that each netperf was bound to a single core which had its own dedicated TX queue?

I ran on a Chelsio multiple TX queue card but I ran the default netperf without any tuning (irqbalance, irq binding, cpu binding of netperf/netserver, sysctl, etc). Do you want me to try with a specific tuning also?

thanks,

- KK