All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] iwlwifi: Auto-tune tx queue size to maintain latency under load
@ 2011-02-13 17:56 Nathaniel J. Smith
  2011-02-13 17:56 ` [PATCH 1/5] iwlwifi: Simplify tx queue management Nathaniel J. Smith
                   ` (7 more replies)
  0 siblings, 8 replies; 48+ messages in thread
From: Nathaniel J. Smith @ 2011-02-13 17:56 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, wey-yi.w.guy, ilw, Nathaniel J. Smith

I have an iwl3945 in my laptop, and find that whenever I saturate the
outgoing connection -- which happens daily when my rsync backup kicks
in -- then latency becomes astronomical (what Jim Gettys calls
"bufferbloat"). I've measured 12-13 second ping times to my router. As
you can imagine, this makes web browsing or interactive SSH somewhat
uncomfortable.

The problem is the very large TX queue in the iwlwifi driver, which is
non-adjustable and willing to buffer several hundred packets at a
time. My pings, HTTP connections, and so on get stuck at the end of
this line, and have to wait for multiple seconds while all the packets
ahead of them get sent.

(A secondary problem is the txqueue in the network layer, but this can
be fixed via 'ip link set wlan0 txqueuelen $LEN', or by traffic
shaping. But so long as the driver queue is so huge, neither really
makes any difference.)

This patch series teaches the driver to measure the average rate of
packet transmission for each tx queue, and adjusts the queue size
dynamically in an attempt to achieve ~2 ms of added latency.

Patches are against wireless-testing (0fd54899). All patches tested on
iwl3945 hardware. I've been running the full patch (against an earlier
wireless-testing) full time for more than a month, and it's been just
as reliable as the standard driver.

Hard numbers
------------
I made a test file:
  dd if=/dev/urandom of=/tmp/50-megs bs=1M count=50
Then ran a test load and a latency measurement, started at the same time:
  scp /tmp/50-megs 192.168.16.1:/dev/zero
  sleep 20 && ping -n 192.168.16.1 -c 20 -q
Measurements are on my home network, which is not the cleanest
environment, and bandwidth fluctuates enough that it isn't worth
reporting (scp reports between ~100KB/s and 200KB/s). But at least
it's realistic... Each test performed twice, in intermixed order.

(numbers are RTT min/avg/max/mdev in ms, as reported by ping)

Baseline: current wireless-testing, with txqueuelen 1000
  1550.601  5404.818  8672.305  2423.160 ms
  1484.907  4554.160  6632.850  1326.948 ms

Best currently achievable: current wireless-testing, with txqueuelen 2
  2196.802  4121.507  6009.160   910.079 ms
  1092.415  2170.247  3860.628   674.256 ms

New best: patched wireless-testing, with txqueuelen 2
     3.812    44.419    95.883    26.462 ms
     1.793    34.926   137.325    33.161 ms

As you can see, this patch achieves something like a 2 order of
magnitude reduction in RTT, and if there's any effect on throughput
then it's too subtle to notice in my environment. (The single highest
observed throughput was actually in the second test of the patched
kernel.)

Nathaniel J. Smith (5):
  iwlwifi: Simplify tx queue management
  iwlwifi: Convert the tx queue high_mark to an atomic_t
  iwlwifi: Invert the sense of the queue high_mark
  iwlwifi: auto-tune tx queue size to minimize latency
  iwlwifi: make current tx queue sizes visible in debugfs

 drivers/net/wireless/iwlwifi/iwl-3945.c     |    6 ++-
 drivers/net/wireless/iwlwifi/iwl-4965.c     |    4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-lib.c  |    4 +-
 drivers/net/wireless/iwlwifi/iwl-agn-tx.c   |   11 +++-
 drivers/net/wireless/iwlwifi/iwl-core.h     |    1 +
 drivers/net/wireless/iwlwifi/iwl-debugfs.c  |    6 ++-
 drivers/net/wireless/iwlwifi/iwl-dev.h      |   20 ++++++--
 drivers/net/wireless/iwlwifi/iwl-tx.c       |   62 ++++++++++++++++++++-------
 drivers/net/wireless/iwlwifi/iwl3945-base.c |    7 ++-
 9 files changed, 87 insertions(+), 34 deletions(-)


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

end of thread, other threads:[~2011-02-28 13:07 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-13 17:56 [PATCH 0/5] iwlwifi: Auto-tune tx queue size to maintain latency under load Nathaniel J. Smith
2011-02-13 17:56 ` [PATCH 1/5] iwlwifi: Simplify tx queue management Nathaniel J. Smith
2011-02-14  9:57   ` Johannes Berg
2011-02-14 22:17     ` Nathaniel Smith
2011-02-14 22:45       ` wwguy
2011-02-15  0:15         ` Dave Täht
2011-02-16  9:16         ` Stanislaw Gruszka
2011-02-16 14:41           ` John W. Linville
2011-02-16 15:13             ` wwguy
2011-02-15 12:11       ` Johannes Berg
2011-02-14 15:33   ` wwguy
2011-02-13 17:56 ` [PATCH 2/5] iwlwifi: Convert the tx queue high_mark to an atomic_t Nathaniel J. Smith
2011-02-14 12:16   ` Johannes Berg
2011-02-14 22:35     ` Nathaniel Smith
2011-02-15 12:08       ` Johannes Berg
2011-02-15 17:37         ` Nathaniel Smith
2011-02-13 17:56 ` [PATCH 3/5] iwlwifi: Invert the sense of the queue high_mark Nathaniel J. Smith
2011-02-13 17:56 ` [PATCH 4/5] iwlwifi: auto-tune tx queue size to minimize latency Nathaniel J. Smith
2011-02-14 12:17   ` Johannes Berg
2011-02-14 21:58     ` Nathaniel Smith
2011-02-15 12:13       ` Johannes Berg
2011-02-15 15:03         ` John W. Linville
2011-02-16  8:59           ` Johannes Berg
2011-02-15 17:31         ` Nathaniel Smith
2011-02-14 15:46   ` wwguy
2011-02-13 17:56 ` [PATCH 5/5] iwlwifi: make current tx queue sizes visible in debugfs Nathaniel J. Smith
2011-02-14  0:32 ` [PATCH 0/5] iwlwifi: Auto-tune tx queue size to maintain latency under load Julian Calaby
2011-02-14  3:28   ` Nathaniel Smith
2011-02-16 15:50 ` John W. Linville
2011-02-16 23:08   ` Nathaniel Smith
2011-02-16 23:42     ` wwguy
2011-02-17  1:49 ` [RFC] mac80211: implement eBDP algorithm to fight bufferbloat John W. Linville
2011-02-17  3:31   ` Ben Greear
2011-02-17  4:26   ` Nathaniel Smith
2011-02-17  8:31   ` Johannes Berg
2011-02-18 21:21   ` [RFC v2] " John W. Linville
2011-02-19  3:44     ` Nathaniel Smith
2011-02-21 18:47       ` John W. Linville
2011-02-21 23:26         ` Nathaniel Smith
2011-02-23 22:28           ` John W. Linville
2011-02-25 18:21             ` Nathaniel Smith
2011-02-25 18:27               ` Nathaniel Smith
2011-02-20  0:37     ` Nathaniel Smith
2011-02-21 18:52       ` John W. Linville
2011-02-21 15:28     ` Johannes Berg
2011-02-21 19:06       ` John W. Linville
2011-02-21 20:26         ` Tianji Li
2011-02-28 13:07         ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.