From: Dany Madden <drt@linux.ibm.com>
To: Lijun Pan <lijunp213@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: ibm: replenish rx pool and poll less frequently
Date: Wed, 02 Jun 2021 11:23:04 -0700 [thread overview]
Message-ID: <a85942b56e72cae74d23bd8ab379490e@imap.linux.ibm.com> (raw)
In-Reply-To: <4765c54a8cb7b87ae1d7db928c44f40b@imap.linux.ibm.com>
On 2021-06-02 10:58, Dany Madden wrote:
> On 2021-06-02 10:01, Lijun Pan wrote:
>> The old mechanism replenishes rx pool even only one frames is
>> processed in
>> the poll function, which causes lots of overheads. The old mechanism
>> restarts polling until processed frames reaches the budget, which can
>> cause the poll function to loop into restart_poll 63 times at most and
>> to
>> call replenish_rx_poll 63 times at most. This will cause soft lockup
>> very
>> easily. So, don't replenish too often, and don't goto restart_poll in
>> each
>> poll function. If there are pending descriptors, fetch them in the
>> next
>> poll instance.
>
> Does this improve performance?
>
>>
>> Signed-off-by: Lijun Pan <lijunp213@gmail.com>
>> ---
>> drivers/net/ethernet/ibm/ibmvnic.c | 15 +++------------
>> 1 file changed, 3 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
>> b/drivers/net/ethernet/ibm/ibmvnic.c
>> index ffb2a91750c7..fae1eaa39dd0 100644
>> --- a/drivers/net/ethernet/ibm/ibmvnic.c
>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
>> @@ -2435,7 +2435,6 @@ static int ibmvnic_poll(struct napi_struct
>> *napi, int budget)
>> frames_processed = 0;
>> rx_scrq = adapter->rx_scrq[scrq_num];
>>
>> -restart_poll:
>> while (frames_processed < budget) {
>> struct sk_buff *skb;
>> struct ibmvnic_rx_buff *rx_buff;
>> @@ -2512,20 +2511,12 @@ static int ibmvnic_poll(struct napi_struct
>> *napi, int budget)
>> }
>>
>> if (adapter->state != VNIC_CLOSING &&
>> - ((atomic_read(&adapter->rx_pool[scrq_num].available) <
>> - adapter->req_rx_add_entries_per_subcrq / 2) ||
>> - frames_processed < budget))
>
> There is a budget that the driver should adhere to. Even one frame, it
> should still process the frame within a budget.
I meant it should replenish the buffer because the commit that added
this check,
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=41ed0a00ffcd903ece4304a4a65d95706115ffcb,
stated that low frame_processed means low incoming packets, so use the
time to refill the buffers.
So, it would be good to see some numbers of how this change is doing in
comparison to the code before.
>
>> + (atomic_read(&adapter->rx_pool[scrq_num].available) <
>> + adapter->req_rx_add_entries_per_subcrq / 2))
>> replenish_rx_pool(adapter, &adapter->rx_pool[scrq_num]);
>> if (frames_processed < budget) {
>> - if (napi_complete_done(napi, frames_processed)) {
>> + if (napi_complete_done(napi, frames_processed))
>> enable_scrq_irq(adapter, rx_scrq);
>> - if (pending_scrq(adapter, rx_scrq)) {
>> - if (napi_reschedule(napi)) {
>> - disable_scrq_irq(adapter, rx_scrq);
>> - goto restart_poll;
>> - }
>> - }
>> - }
>> }
>> return frames_processed;
>> }
next prev parent reply other threads:[~2021-06-02 18:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 17:01 [PATCH net-next] net: ibm: replenish rx pool and poll less frequently Lijun Pan
2021-06-02 17:47 ` Rick Lindsley
2021-06-02 17:58 ` Dany Madden
2021-06-02 18:23 ` Dany Madden [this message]
2021-06-02 19:25 ` Sukadev Bhattiprolu
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=a85942b56e72cae74d23bd8ab379490e@imap.linux.ibm.com \
--to=drt@linux.ibm.com \
--cc=lijunp213@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).