[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aa085d47-1163-6133-ed71-88eedb47dabe@ooseel.net>
Date: Mon, 26 Dec 2022 15:24:57 +0900
From: Leesoo Ahn <lsahn@...eel.net>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Oliver Neukum <oneukum@...e.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Greg KH <greg@...ah.com>,
netdev@...r.kernel.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] usbnet: optimize usbnet_bh() to reduce CPU load
22. 12. 22. 20:13에 Paolo Abeni 이(가) 쓴 글:
> On Wed, 2022-12-21 at 16:59 +0900, Leesoo Ahn wrote:
>> The current source pushes skb into dev->done queue by calling
>> skb_queue_tail() and then pop it by calling skb_dequeue() to branch to
>> rx_cleanup state for freeing urb/skb in usbnet_bh(). It takes extra CPU
>> load, 2.21% (skb_queue_tail) as follows.
>>
>> - 11.58% 0.26% swapper [k] usbnet_bh
>> - 11.32% usbnet_bh
>> - 6.43% skb_dequeue
>> 6.34% _raw_spin_unlock_irqrestore
>> - 2.21% skb_queue_tail
>> 2.19% _raw_spin_unlock_irqrestore
>> - 1.68% consume_skb
>> - 0.97% kfree_skbmem
>> 0.80% kmem_cache_free
>> 0.53% skb_release_data
>>
>> To reduce the extra CPU load use return values jumping to rx_cleanup
>> state directly to free them instead of calling skb_queue_tail() and
>> skb_dequeue() for push/pop respectively.
>>
>> - 7.87% 0.25% swapper [k] usbnet_bh
>> - 7.62% usbnet_bh
>> - 4.81% skb_dequeue
>> 4.74% _raw_spin_unlock_irqrestore
>> - 1.75% consume_skb
>> - 0.98% kfree_skbmem
>> 0.78% kmem_cache_free
>> 0.58% skb_release_data
>> 0.53% smsc95xx_rx_fixup
>>
>> Signed-off-by: Leesoo Ahn <lsahn@...eel.net>
>> ---
>> v3:
>> - Replace return values with proper -ERR values in rx_process()
>>
>> v2:
>> - Replace goto label with return statement to reduce goto entropy
>> - Add CPU load information by perf in commit message
>>
>> v1 at:
>> https://patchwork.kernel.org/project/netdevbpf/patch/20221217161851.829497-1-lsahn@ooseel.net/
>
> This looks like net-next material.
>
> We have already submitted the networking pull request to Linus
> for v6.2 and therefore net-next is closed for new drivers, features,
> code refactoring and optimizations. We are currently accepting
> bug fixes only.
>
> Please repost when net-next reopens after Jan 2nd, including the
> expected 'net-next' tag into the subject line
>
> RFC patches sent for review only are obviously welcome at any time.
>
> [...]
>
>> @@ -1528,13 +1526,14 @@ static void usbnet_bh (struct timer_list *t)
>> entry = (struct skb_data *) skb->cb;
>> switch (entry->state) {
>> case rx_done:
>> - entry->state = rx_cleanup;
>> - rx_process (dev, skb);
>> + if (rx_process(dev, skb))
>> + goto cleanup;
>
> You can avoid this additional label (which is a little confusing inside
> a switch) factoring out a usb_free_skb(skb) helper and calling it here
> and under the rx_cleanup case.
Thank you for the information and feedback, it will be in v4 when
net-next reopens.
Best regards,
Leesoo
Powered by blists - more mailing lists