Re: [PATCH wireless-next] wifi: mac80211: fold tid_ampdu_rx allocations into a flexible array
From: Rosen Penev
Date: Thu Jun 04 2026 - 20:48:35 EST
On Thu Jun 4, 2026 at 5:20 AM PDT, Johannes Berg wrote:
> On Wed, 2026-06-03 at 17:14 -0700, Rosen Penev wrote:
>> Convert the separately-allocated reorder_buf pointer to a C99 flexible
>> array member at the end of struct tid_ampdu_rx, and place reorder_time
>> in the same allocation immediately after it. This collapses three
>> allocations into one and removes the corresponding kfree() pairs from
>> the error and free paths.
>
> As I pointed out before, I'm not a huge fan of these "doing a minor
> improvement for the sake of it" contributions ...
You say that but these have resulted in missing kfrees being discovered
throughout the tree.
>
>> @@ -241,7 +241,6 @@ struct tid_ampdu_rx {
>> struct rcu_head rcu_head;
>> spinlock_t reorder_lock;
>> u64 reorder_buf_filtered;
>> - struct sk_buff_head *reorder_buf;
>> unsigned long *reorder_time;
>> struct sta_info *sta;
>> struct timer_list session_timer;
>> @@ -256,6 +255,7 @@ struct tid_ampdu_rx {
>> u8 auto_seq:1,
>> removed:1,
>> started:1;
>> + struct sk_buff_head reorder_buf[];
>
> Given that sizeof(unsigned long) == sizeof(void *), that would probably
> be far simpler as
>
> struct {
> struct sk_buf_head buf;
> unsigned long time;
> } reorder[];
>
> or so.
This is indeed much better. Will make the change.
>
> johannes