All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: [PATCH 2/5] mac80211: fix memory accounting with A-MSDU aggregation
Date: Sat, 16 Mar 2019 18:06:31 +0100	[thread overview]
Message-ID: <20190316170634.13125-2-nbd@nbd.name> (raw)
In-Reply-To: <20190316170634.13125-1-nbd@nbd.name>

skb->truesize can change due to memory reallocation or when adding extra
fragments. Adjust fq->memory_usage accordingly

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/tx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 51cc37802439..0b73a0fe8218 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3227,6 +3227,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
 	u8 max_subframes = sta->sta.max_amsdu_subframes;
 	int max_frags = local->hw.max_tx_fragments;
 	int max_amsdu_len = sta->sta.max_amsdu_len;
+	int orig_truesize;
 	__be16 len;
 	void *data;
 	bool ret = false;
@@ -3267,6 +3268,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
 	if (!head || skb_is_gso(head))
 		goto out;
 
+	orig_truesize = head->truesize;
 	orig_len = head->len;
 
 	if (skb->len + head->len > max_amsdu_len)
@@ -3324,6 +3326,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
 	*frag_tail = skb;
 
 out_recalc:
+	fq->memory_usage += head->truesize - orig_truesize;
 	if (head->len != orig_len) {
 		flow->backlog += head->len - orig_len;
 		tin->backlog_bytes += head->len - orig_len;
-- 
2.17.0


  reply	other threads:[~2019-03-16 17:06 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-16 17:06 [PATCH 1/5] mac80211: mesh: drop redundant rcu_read_lock/unlock calls Felix Fietkau
2019-03-16 17:06 ` Felix Fietkau [this message]
2019-03-16 18:12   ` [PATCH 2/5] mac80211: fix memory accounting with A-MSDU aggregation Toke Høiland-Jørgensen
2019-03-16 17:06 ` [PATCH 3/5] mac80211: calculate hash for fq without holding fq->lock in itxq enqueue Felix Fietkau
2019-03-16 18:13   ` Toke Høiland-Jørgensen
2019-03-16 17:06 ` [PATCH 4/5] mac80211: run late dequeue late tx handlers without holding fq->lock Felix Fietkau
2019-03-16 18:13   ` Toke Høiland-Jørgensen
2022-12-05  9:46   ` Wen Gong
2022-12-05  9:46     ` Wen Gong
2022-12-07  6:30     ` Wen Gong
2022-12-07  6:30       ` Wen Gong
2022-12-12  8:31       ` Wen Gong
2022-12-12  8:31         ` Wen Gong
2019-03-16 17:06 ` [PATCH 5/5] mac80211: set NETIF_F_LLTX when using intermediate tx queues Felix Fietkau
2019-03-16 18:14   ` Toke Høiland-Jørgensen
2019-04-14  9:44     ` Arend Van Spriel
2019-04-14 11:19       ` Felix Fietkau
2019-04-14 12:34         ` Arend Van Spriel
2019-04-16  7:34           ` Arend Van Spriel
2019-04-16  7:44       ` Herbert Xu
2019-04-16  8:04         ` Arend Van Spriel
2019-04-16  8:36           ` Herbert Xu
2019-04-16  8:37             ` Johannes Berg
2019-04-16  9:17               ` Arend Van Spriel
2019-04-16  9:29                 ` Herbert Xu
2019-04-16  9:33               ` Toke Høiland-Jørgensen
2019-04-16  9:33                 ` Johannes Berg
2019-04-16  9:37                   ` Herbert Xu
2019-04-16  9:39                     ` Johannes Berg
2019-04-16 10:02                       ` Toke Høiland-Jørgensen
2019-04-17  2:11                         ` Herbert Xu
2019-04-17  8:28                           ` Toke Høiland-Jørgensen
2019-04-16 13:13                       ` Herbert Xu
2019-04-16 13:18                         ` Toke Høiland-Jørgensen
2019-04-17  3:38                           ` Herbert Xu
2019-04-17  9:09                             ` Toke Høiland-Jørgensen
2019-04-17  9:16                               ` Arend Van Spriel
2019-04-17  9:17                             ` Toke Høiland-Jørgensen
2019-04-23 12:41                               ` Johannes Berg
2019-04-25  8:35                                 ` Herbert Xu
2019-04-25  8:39                                   ` Johannes Berg
2019-04-25  8:44                                     ` Herbert Xu
2019-04-25  8:49                                       ` Johannes Berg
2019-04-16 19:13                         ` Johannes Berg
2019-04-17  2:13                           ` Herbert Xu
2019-04-16  9:38                   ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190316170634.13125-2-nbd@nbd.name \
    --to=nbd@nbd.name \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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 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.