From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2.tohojo.dk (mail2.tohojo.dk [77.235.48.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id A3AA93B2D4 for ; Fri, 23 Sep 2016 15:59:26 -0400 (EDT) X-Virus-Scanned: amavisd-new at mail2.tohojo.dk DKIM-Filter: OpenDKIM Filter v2.10.3 mail2.tohojo.dk E5F9741625 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=201310; t=1474660763; bh=kYpSdbj7F27Bgsw9F+SnflqXy7WlWcH/6k8ItvrTO+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+ashl6X6THdeWorsO7m5RXiKxM9G7wFUXKWv1yiheHv15hDUAjkAIOElqQa1oRHE oDwj4UOMiHYhIXKD6HdPV6lX6N4yxutf+KF2PDbHs/MzZ4H44d7PtXjgFtAzyYQ45m PeTDHvIlVndyQZxd/NWHm3o1h06yqCka/CqNSgZo= Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id CFA8E963B; Fri, 23 Sep 2016 21:59:21 +0200 (CEST) From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= To: make-wifi-fast@lists.bufferbloat.net, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Date: Fri, 23 Sep 2016 21:59:11 +0200 Message-Id: <20160923195911.4572-4-toke@toke.dk> In-Reply-To: <20160923195911.4572-1-toke@toke.dk> References: <20160923195911.4572-1-toke@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Make-wifi-fast] [PATCH 3/3] mac80211: Set lower memory limit for non-VHT devices X-BeenThere: make-wifi-fast@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2016 19:59:26 -0000 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=C3=B8iland-J=C3=B8rgensen --- 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_loca= l *local) struct fq *fq =3D &local->fq; int ret; int i; + bool supp_vht =3D false; + enum nl80211_band band; =20 if (!local->ops->wake_tx_queue) return 0; @@ -1442,6 +1444,22 @@ int ieee80211_txq_setup_flows(struct ieee80211_loc= al *local) if (ret) return ret; =20 + /* + * 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 =3D 0; band < NUM_NL80211_BANDS; band++) { + struct ieee80211_supported_band *sband; + + sband =3D local->hw.wiphy->bands[band]; + if (!sband) + continue; + + supp_vht =3D supp_vht || sband->vht_cap.vht_supported; + } + if (!supp_vht) + fq->memory_limit =3D 4 << 20; /* 4 Mbytes */ + codel_params_init(&local->cparams); local->cparams.interval =3D MS2TIME(100); local->cparams.target =3D MS2TIME(20); --=20 2.9.3