quick question about core affinity

Stephen Hemminger stephen at networkplumber.org
Wed Apr 26 18:27:16 CEST 2023


On Wed, 26 Apr 2023 14:20:30 +0200
Lukáš Šišmiš <sismis at cesnet.cz> wrote:

> Hi,
> 
> 
> DPDK core affinity runs your application on the selected cores. But that 
> doesn't stop other applications from running on the same cores.
> 
> To get closer to your goal of really isolating the application from 
> other processes you would need to add isolcpus to your boot parameters.
> 
> That instructs the scheduler to not use the mentioned cores. After 
> booting with this parameter you could run your DPDK application and 
> scheduler would not schedule any process to the cores that DPDK 
> application would use.
> 
> However, if you run a separate application and with the taskset command 
> pin it to the cores your DPDK application uses that will still run and 
> will be in conflict with your DPDK app.
> 
> 
> Best regards,
> 
> Lukas
> 
> On 26. 04. 23 13:37, 이재홍 wrote:
> > Hello, I'm new to DPDK
> >
> > I've tried to run samples and got a query about core affinity.
> > As I understand, if a lcore has affinity to a CPU set, it will run 
> > only on the CPU set.
> > And I thought If I run a dpdk sample with core 0-2, none process can 
> > use the core (0-2). but when I try to run a simple app(not dpdk app) 
> > with taskset command, it runs on 0, 1, 2 cores..
> >
> > what I want was if I use cores for dpdk apps none other process can 
> > access the cores.. but it seems possible..
> >
> > I've googled to find out this but I couldn't find anything I wanted.
> > Is there anyone can explain about this...?

Look up "DPDK core isolation".

More detail in here: https://www.suse.com/c/cpu-isolation-introduction-part-1/

There are multiple ways to do this, the simplest one is to set the kernel
command line so that on boot the scheduler does not use the isolated cores.
The more complex one recommended for production is to use cgroups
and systemd.

You can't isolate CPU 0. It is special and used for system interrupts etc.
In general, don't use CPU 0 for DPDK applications.

There are other performance tuning considerations such as IRQ affinity,
nohz_full and rcu isolation that are also worth looking at.





More information about the users mailing list