[dpdk-dev] [PATCH] testpmd: add nanosleep in main loop

Marcelo Tosatti mtosatti at redhat.com
Sat Nov 11 04:54:14 CET 2017


On Fri, Nov 10, 2017 at 11:14:51AM +0000, Bruce Richardson wrote:
> On Fri, Nov 10, 2017 at 11:42:56AM +0100, Daniel Bristot de Oliveira wrote:
> > 
> > 
> > On 11/10/2017 11:14 AM, Ananyev, Konstantin wrote:
> > > Agree with Adrian here - the patch doesn't fix the problem in any case,
> > 
> > I would agree with you if it were possible to assume one can fully
> > isolate a CPU on Linux... but it is not...
> > 
> > This:
> > https://lwn.net/Articles/659490/
> > 
> > is still an open issue, and the reason why it is an open issue is the
> > kernel threads that need to run on every CPU, mainly when using the
> > PREEMPT_RT, which turns almost everything on threads.
> > 
> > > while introducing an unnecessary slowdown in testpmd iofwd mode.
> > > Please think up some other approach.
> > 
> > The other approach is to increase the priority of all other threads that
> > run on the isolate CPU. But that is not a good idea at all, as the other
> > threads might preempt the busy-loop thread at the worst possible moment.
> > 
> > Using the knowledge of the thread about when it is the best time to give
> > a chance for other threads to run would be a smarter decision.
> > 
> I don't like having this in the main loop either, and to echo others I
> wouldn't have thought that testpmd was actually used as anything other
> than a testing app. Also, I would have thought that running it at
> realtime priority wouldn't be a good idea, because of exactly this
> problem.

Bruce,

Its just as an example for application developers, in the official DPDK
repository. And its disabled by default so it does not affect the
performance numbers.

That said, you have a problem integrating the patch?

> On the specifics of the solution, would using sched_yield() rather than
> nanosleep not be more suitable, given that the reason for this sleep is
> just to give the CPU to other threads?
> 
> /Bruce

Yes but unfortunately "sched_yield()" does not return in a timely
fashion, we would need a new "sched_yield_time(X us)" with a 
guaranteed return from the call in a maximum of X us.

(Note the values of nanosleep_frequency=100Hz, nanosleep_length=10us, 
does increase the latency values a bit but still maintains acceptable
latency). The arguments about performance must be considered
against this results.




Yes Bruce sched_yield() would be mkore


More information about the dev mailing list