From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: make-wifi-fast@lists.bufferbloat.net,
linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Subject: [Make-wifi-fast] [PATCH 3/3] mac80211: Set lower memory limit for non-VHT devices
Date: Fri, 23 Sep 2016 21:59:11 +0200 [thread overview]
Message-ID: <20160923195911.4572-4-toke@toke.dk> (raw)
In-Reply-To: <20160923195911.4572-1-toke@toke.dk>
Small devices can run out of memory from queueing too many packets. If
VHT is not supported by the PHY, having more than 4 MBytes of total
queue in the TXQ intermediate queues is not needed, and so we can safely
limit the memory usage in these cases and avoid OOM.
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
net/mac80211/tx.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1ff08be..82f41fc 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1434,6 +1434,8 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local)
struct fq *fq = &local->fq;
int ret;
int i;
+ bool supp_vht = false;
+ enum nl80211_band band;
if (!local->ops->wake_tx_queue)
return 0;
@@ -1442,6 +1444,22 @@ int ieee80211_txq_setup_flows(struct ieee80211_local *local)
if (ret)
return ret;
+ /*
+ * If the hardware doesn't support VHT, it is safe to limit the maximum
+ * queue size. 4 Mbytes is 64 max-size aggregates in 802.11n.
+ */
+ for (band = 0; band < NUM_NL80211_BANDS; band++) {
+ struct ieee80211_supported_band *sband;
+
+ sband = local->hw.wiphy->bands[band];
+ if (!sband)
+ continue;
+
+ supp_vht = supp_vht || sband->vht_cap.vht_supported;
+ }
+ if (!supp_vht)
+ fq->memory_limit = 4 << 20; /* 4 Mbytes */
+
codel_params_init(&local->cparams);
local->cparams.interval = MS2TIME(100);
local->cparams.target = MS2TIME(20);
--
2.9.3
next prev parent reply other threads:[~2016-09-23 19:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 19:59 [Make-wifi-fast] [PATCH 0/3] Add memory limits to fq.h and mac80211 TXQ Toke Høiland-Jørgensen
2016-09-23 19:59 ` [Make-wifi-fast] [PATCH 1/3] fq.h: Port memory limit mechanism from fq_codel Toke Høiland-Jørgensen
2016-09-23 19:59 ` [Make-wifi-fast] [PATCH 2/3] mac80211: Export fq memory limit information in debugfs Toke Høiland-Jørgensen
2016-09-23 19:59 ` Toke Høiland-Jørgensen [this message]
2016-09-30 11:33 ` [Make-wifi-fast] [PATCH 3/3] mac80211: Set lower memory limit for non-VHT devices Johannes Berg
2016-09-30 12:41 ` Toke Høiland-Jørgensen
2016-09-30 12:51 ` Johannes Berg
2016-09-30 14:35 ` Toke Høiland-Jørgensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.bufferbloat.net/postorius/lists/make-wifi-fast.lists.bufferbloat.net/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160923195911.4572-4-toke@toke.dk \
--to=toke@toke.dk \
--cc=linux-wireless@vger.kernel.org \
--cc=make-wifi-fast@lists.bufferbloat.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox