From: Eric Dumazet <eric.dumazet@gmail.com>
To: Gatis Peisenieks <gatis@mikrotik.com>,
chris.snook@gmail.com, davem@davemloft.net, kuba@kernel.org,
hkallweit1@gmail.com, jesse.brandeburg@intel.com,
dchickles@marvell.com, tully@mikrotik.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] atl1c: move tx cleanup processing out of interrupt
Date: Thu, 1 Apr 2021 23:46:36 +0200 [thread overview]
Message-ID: <b63fcab6-ad2f-c356-6818-08e497ff13e1@gmail.com> (raw)
In-Reply-To: <a5f7c8ea7e090921da7e8f3d4680e4c3@mikrotik.com>
On 4/1/21 7:32 PM, Gatis Peisenieks wrote:
> Tx queue cleanup happens in interrupt handler on same core as rx queue processing.
> Both can take considerable amount of processing in high packet-per-second scenarios.
>
> Sending big amounts of packets can stall the rx processing which is unfair
> and also can lead to to out-of-memory condition since __dev_kfree_skb_irq
> queues the skbs for later kfree in softirq which is not allowed to happen
> with heavy load in interrupt handler.
>
> This puts tx cleanup in its own napi to be executed on different core than rx
> cleanup which solves the mentioned problems and increases the throughput.
>
> The ability to sustain equal amounts of tx/rx traffic increased:
> from 280Kpps to 1130Kpps on Threadripper 3960X with upcoming Mikrotik 10/25G NIC,
> from 520Kpps to 850Kpps on Intel i3-3320 with Mikrotik RB44Ge adapter.
>
> Signed-off-by: Gatis Peisenieks <gatis@mikrotik.com>
> }
> }
> - if (status & ISR_TX_PKT)
> - atl1c_clean_tx_irq(adapter, atl1c_trans_normal);
> + if (status & ISR_TX_PKT) {
> + if (napi_schedule_prep(&adapter->tx_napi)) {
> + int tx_cpu = (smp_processor_id() + 1) %
> + num_online_cpus();
Ouch. Please do not burry in a driver such hard-coded facility.
There is no guarantee tx_cpu is an online cpu .
> + spin_lock(&adapter->irq_mask_lock);
> + hw->intr_mask &= ~ISR_TX_PKT;
> + AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
> + spin_unlock(&adapter->irq_mask_lock);
> + smp_call_function_single_async(tx_cpu,
> + &adapter->csd);
> + }
> + }
>
Have you tried using a second NAPI, but no csd ?
We now have kthread napi [1]
By simply enabling kthread NAPI on your NIC, you should get same nice behavior.
As a bonus, on moderate load you would use a single cpu instead of two.
[1]
cb038357937ee4f589aab2469ec3896dce90f317 net: fix race between napi kthread mode and busy poll
5fdd2f0e5c64846bf3066689b73fc3b8dddd1c74 net: add sysfs attribute to control napi threaded mode
29863d41bb6e1d969c62fdb15b0961806942960e net: implement threaded-able napi poll loop support
prev parent reply other threads:[~2021-04-01 21:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 17:32 Gatis Peisenieks
2021-04-01 21:46 ` Eric Dumazet [this message]
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=b63fcab6-ad2f-c356-6818-08e497ff13e1@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=chris.snook@gmail.com \
--cc=davem@davemloft.net \
--cc=dchickles@marvell.com \
--cc=gatis@mikrotik.com \
--cc=hkallweit1@gmail.com \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tully@mikrotik.com \
/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
Powered by JetHome