Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-16 Thread Eric Dumazet
On Mon, May 16, 2016 at 6:10 AM, Paolo Abeni wrote: > > I'm sorry for the not-so-prompt reply. I had to use a different H/W, so > I had to re-run the tests with all the patch flavors to get comparable > results. > > While I can confirm that adding the '!ksoftirqd_running()' condition > improves th

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-16 Thread Paolo Abeni
On Fri, 2016-05-13 at 10:36 -0700, Eric Dumazet wrote: > On Fri, May 13, 2016 at 10:19 AM, Paolo Abeni wrote: > > > The difference is small, in the noise range: > > > > [with this patch applied] > > super_netperf 100 -H 192.168.122.1 -t UDP_STREAM -l 60 -- -m 1 > > 9.00 > > > > [adding the test i

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-13 Thread Eric Dumazet
On Fri, May 13, 2016 at 10:19 AM, Paolo Abeni wrote: > The difference is small, in the noise range: > > [with this patch applied] > super_netperf 100 -H 192.168.122.1 -t UDP_STREAM -l 60 -- -m 1 > 9.00 > > [adding the test into __local_bh_enable_ip(), too] > super_netperf 100 -H 192.168.122.1 -t

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-13 Thread Paolo Abeni
On Fri, 2016-05-13 at 10:03 -0700, Eric Dumazet wrote: > On Fri, May 13, 2016 at 9:50 AM, Paolo Abeni wrote: > > >> Indeed, and the patch looks quite simple now ;) > >> > >> diff --git a/kernel/softirq.c b/kernel/softirq.c > >> index > >> 17caf4b63342d7839528f367b283a386413b0362..23c364485d03618

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-13 Thread Eric Dumazet
On Fri, May 13, 2016 at 9:50 AM, Paolo Abeni wrote: >> Indeed, and the patch looks quite simple now ;) >> >> diff --git a/kernel/softirq.c b/kernel/softirq.c >> index >> 17caf4b63342d7839528f367b283a386413b0362..23c364485d03618773c385d943c0ef39f5931d09 >> 100644 >> --- a/kernel/softirq.c >> +++

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-13 Thread Paolo Abeni
On Wed, 2016-05-11 at 14:56 -0700, Eric Dumazet wrote: > On Wed, 2016-05-11 at 08:55 +0200, Peter Zijlstra wrote: > > On Tue, May 10, 2016 at 03:51:37PM -0700, Eric Dumazet wrote: > > > diff --git a/kernel/softirq.c b/kernel/softirq.c > > > index 17caf4b63342..22463217e3cf 100644 > > > --- a/kernel

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-12 Thread Eric Dumazet
On Thu, 2016-05-12 at 22:58 +0200, Paolo Abeni wrote: > On Thu, 2016-05-12 at 13:49 -0700, Eric Dumazet wrote: > > On Thu, 2016-05-12 at 22:07 +0200, Paolo Abeni wrote: > > > > > > > static inline bool ksoftirqd_running(void) > > > > > { > > > > > return __this_cpu_read(ksoftirqd)->state ==

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-12 Thread Paolo Abeni
On Thu, 2016-05-12 at 13:49 -0700, Eric Dumazet wrote: > On Thu, 2016-05-12 at 22:07 +0200, Paolo Abeni wrote: > > > > > static inline bool ksoftirqd_running(void) > > > > { > > > > return __this_cpu_read(ksoftirqd)->state == TASK_RUNNING; > > > > here something like: > > > > struct

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-12 Thread Eric Dumazet
On Thu, 2016-05-12 at 22:07 +0200, Paolo Abeni wrote: > > > static inline bool ksoftirqd_running(void) > > > { > > > return __this_cpu_read(ksoftirqd)->state == TASK_RUNNING; > > here something like: > > struct task_struct *tsk = __this_cpu_read(ksoftirqd); > return tsk && (tsk->

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-12 Thread Paolo Abeni
On Wed, 2016-05-11 at 14:56 -0700, Eric Dumazet wrote: > On Wed, 2016-05-11 at 08:55 +0200, Peter Zijlstra wrote: > > On Tue, May 10, 2016 at 03:51:37PM -0700, Eric Dumazet wrote: > > > diff --git a/kernel/softirq.c b/kernel/softirq.c > > > index 17caf4b63342..22463217e3cf 100644 > > > --- a/kernel

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Hannes Frederic Sowa
On 11.05.2016 16:45, Eric Dumazet wrote: > On Wed, May 11, 2016 at 7:38 AM, Paolo Abeni wrote: > >> Uh, we have likely the same issue in the net_rx_action() function, which >> also execute with bh disabled and check for jiffies changes even on >> single core hosts ?!? > > That is why we have a l

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Wed, 2016-05-11 at 08:55 +0200, Peter Zijlstra wrote: > On Tue, May 10, 2016 at 03:51:37PM -0700, Eric Dumazet wrote: > > diff --git a/kernel/softirq.c b/kernel/softirq.c > > index 17caf4b63342..22463217e3cf 100644 > > --- a/kernel/softirq.c > > +++ b/kernel/softirq.c > > @@ -56,6 +56,7 @@ EXPOR

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Tue, 2016-05-10 at 14:53 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 17:35 -0400, Rik van Riel wrote: > > > You might need another one of these in invoke_softirq() > > > > Excellent. > > I gave it a quick try (without your suggestion), and host seems to > survive a stress test. Well,

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Wed, 2016-05-11 at 07:40 -0700, Eric Dumazet wrote: > On Wed, May 11, 2016 at 6:13 AM, Hannes Frederic Sowa > wrote: > > > This looks racy to me as the ksoftirqd could be in the progress to stop > > and we would miss another softirq invocation. > > Looking at smpboot_thread_fn(), it looks fin

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Rik van Riel
On Wed, 2016-05-11 at 07:40 -0700, Eric Dumazet wrote: > On Wed, May 11, 2016 at 6:13 AM, Hannes Frederic Sowa > wrote: > > > This looks racy to me as the ksoftirqd could be in the progress to > > stop > > and we would miss another softirq invocation. > > Looking at smpboot_thread_fn(), it looks

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Wed, May 11, 2016 at 7:38 AM, Paolo Abeni wrote: > Uh, we have likely the same issue in the net_rx_action() function, which > also execute with bh disabled and check for jiffies changes even on > single core hosts ?!? That is why we have a loop break after netdev_budget=300 packets. And a sys

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Wed, May 11, 2016 at 6:13 AM, Hannes Frederic Sowa wrote: > This looks racy to me as the ksoftirqd could be in the progress to stop > and we would miss another softirq invocation. Looking at smpboot_thread_fn(), it looks fine : if (!ht->thread_should_run(td->cpu)) {

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Paolo Abeni
On Wed, 2016-05-11 at 06:08 -0700, Eric Dumazet wrote: > On Wed, 2016-05-11 at 11:48 +0200, Paolo Abeni wrote: > > Hi Eric, > > On Tue, 2016-05-10 at 15:51 -0700, Eric Dumazet wrote: > > > On Wed, 2016-05-11 at 00:32 +0200, Hannes Frederic Sowa wrote: > > > > > > > Not only did we want to present

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Hannes Frederic Sowa
On 11.05.2016 15:39, Hannes Frederic Sowa wrote: > I am fine with that. It is us to show clear benefits or use cases for > that. If we fail with that, no problem at all that the patches get > rejected, we don't want to add bloat to the kernel, for sure! At this > point I still think a possibility t

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Hannes Frederic Sowa
Hi all, On 11.05.2016 15:08, Eric Dumazet wrote: > On Wed, 2016-05-11 at 11:48 +0200, Paolo Abeni wrote: >> Hi Eric, >> On Tue, 2016-05-10 at 15:51 -0700, Eric Dumazet wrote: >>> On Wed, 2016-05-11 at 00:32 +0200, Hannes Frederic Sowa wrote: >>> Not only did we want to present this solely as

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Hannes Frederic Sowa
On 11.05.2016 08:55, Peter Zijlstra wrote: > On Tue, May 10, 2016 at 03:51:37PM -0700, Eric Dumazet wrote: >> diff --git a/kernel/softirq.c b/kernel/softirq.c >> index 17caf4b63342..22463217e3cf 100644 >> --- a/kernel/softirq.c >> +++ b/kernel/softirq.c >> @@ -56,6 +56,7 @@ EXPORT_SYMBOL(irq_stat);

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Eric Dumazet
On Wed, 2016-05-11 at 11:48 +0200, Paolo Abeni wrote: > Hi Eric, > On Tue, 2016-05-10 at 15:51 -0700, Eric Dumazet wrote: > > On Wed, 2016-05-11 at 00:32 +0200, Hannes Frederic Sowa wrote: > > > > > Not only did we want to present this solely as a bugfix but also as as > > > performance enhancemen

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-11 Thread Paolo Abeni
Hi Eric, On Tue, 2016-05-10 at 15:51 -0700, Eric Dumazet wrote: > On Wed, 2016-05-11 at 00:32 +0200, Hannes Frederic Sowa wrote: > > > Not only did we want to present this solely as a bugfix but also as as > > performance enhancements in case of virtio (as you can see in the cover > > letter). Giv

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Peter Zijlstra
On Tue, May 10, 2016 at 03:51:37PM -0700, Eric Dumazet wrote: > diff --git a/kernel/softirq.c b/kernel/softirq.c > index 17caf4b63342..22463217e3cf 100644 > --- a/kernel/softirq.c > +++ b/kernel/softirq.c > @@ -56,6 +56,7 @@ EXPORT_SYMBOL(irq_stat); > static struct softirq_action softirq_vec[NR_SO

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Wed, 2016-05-11 at 00:32 +0200, Hannes Frederic Sowa wrote: > Not only did we want to present this solely as a bugfix but also as as > performance enhancements in case of virtio (as you can see in the cover > letter). Given that a long time ago there was a tendency to remove > softirqs complete

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 15:02 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 14:53 -0700, Eric Dumazet wrote: > > On Tue, 2016-05-10 at 17:35 -0400, Rik van Riel wrote: > > > > > You might need another one of these in invoke_softirq() > > > > > > > Excellent. > > > > I gave it a quick try (wi

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Hannes Frederic Sowa
On 10.05.2016 23:09, Eric Dumazet wrote: > On Tue, May 10, 2016 at 1:46 PM, Hannes Frederic Sowa > wrote: > >> I agree here, but I don't think this patch particularly is a lot of >> bloat and something very interesting people can play with and extend upon. >> > > Sure, very rarely patch authors

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 14:53 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 17:35 -0400, Rik van Riel wrote: > > > You might need another one of these in invoke_softirq() > > > > Excellent. > > I gave it a quick try (without your suggestion), and host seems to > survive a stress test. > > O

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Rik van Riel
On Tue, 2016-05-10 at 14:53 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 17:35 -0400, Rik van Riel wrote: > > > > > You might need another one of these in invoke_softirq() > > > Excellent. > > I gave it a quick try (without your suggestion), and host seems to > survive a stress test. > >

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 17:35 -0400, Rik van Riel wrote: > You might need another one of these in invoke_softirq() > Excellent. I gave it a quick try (without your suggestion), and host seems to survive a stress test. Of course we do have to fix these problems : [ 147.781629] NOHZ: local_softi

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Rik van Riel
On Tue, 2016-05-10 at 14:31 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 14:09 -0700, Eric Dumazet wrote: > > > > On Tue, May 10, 2016 at 1:46 PM, Hannes Frederic Sowa > > wrote: > > > > > > > > I agree here, but I don't think this patch particularly is a lot > > > of > > > bloat and some

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 14:09 -0700, Eric Dumazet wrote: > On Tue, May 10, 2016 at 1:46 PM, Hannes Frederic Sowa > wrote: > > > I agree here, but I don't think this patch particularly is a lot of > > bloat and something very interesting people can play with and extend upon. > > > > Sure, very rare

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, May 10, 2016 at 1:46 PM, Hannes Frederic Sowa wrote: > I agree here, but I don't think this patch particularly is a lot of > bloat and something very interesting people can play with and extend upon. > Sure, very rarely patch authors think their stuff is bloat. I prefer to fix kernel so

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Rik van Riel
On Tue, 2016-05-10 at 16:52 -0400, David Miller wrote: > From: Rik van Riel > Date: Tue, 10 May 2016 16:50:56 -0400 > > > On Tue, 2016-05-10 at 16:45 -0400, David Miller wrote: > >> From: Paolo Abeni > >> Date: Tue, 10 May 2016 22:22:50 +0200 > >>  > >> > On Tue, 2016-05-10 at 09:08 -0700, Eric

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread David Miller
From: Rik van Riel Date: Tue, 10 May 2016 16:50:56 -0400 > On Tue, 2016-05-10 at 16:45 -0400, David Miller wrote: >> From: Paolo Abeni >> Date: Tue, 10 May 2016 22:22:50 +0200 >> >> > On Tue, 2016-05-10 at 09:08 -0700, Eric Dumazet wrote: >> >> On Tue, 2016-05-10 at 18:03 +0200, Paolo Abeni wro

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Rik van Riel
On Tue, 2016-05-10 at 16:45 -0400, David Miller wrote: > From: Paolo Abeni > Date: Tue, 10 May 2016 22:22:50 +0200 > > > On Tue, 2016-05-10 at 09:08 -0700, Eric Dumazet wrote: > >> On Tue, 2016-05-10 at 18:03 +0200, Paolo Abeni wrote: > >>  > >> > If a single core host is under network flood, i.e

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Hannes Frederic Sowa
Hello, On 10.05.2016 16:29, Eric Dumazet wrote: > On Tue, 2016-05-10 at 16:11 +0200, Paolo Abeni wrote: >> Currently, the softirq loop can be scheduled both inside the ksofirqd kernel >> thread and inside any running process. This makes nearly impossible for the >> process scheduler to balance in

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread David Miller
From: Paolo Abeni Date: Tue, 10 May 2016 22:22:50 +0200 > On Tue, 2016-05-10 at 09:08 -0700, Eric Dumazet wrote: >> On Tue, 2016-05-10 at 18:03 +0200, Paolo Abeni wrote: >> >> > If a single core host is under network flood, i.e. ksoftirqd is >> > scheduled and it eventually (after processing ~64

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Paolo Abeni
On Tue, 2016-05-10 at 17:57 +0200, Thomas Gleixner wrote: > On Tue, 10 May 2016, Paolo Abeni wrote: > > Nice patch set and very promising results! > > > At this point we are not really sure if we should go with this simpler > > approach by putting NAPI itself into kthreads or leverage the thread

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Paolo Abeni
On Tue, 2016-05-10 at 09:08 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 18:03 +0200, Paolo Abeni wrote: > > > If a single core host is under network flood, i.e. ksoftirqd is > > scheduled and it eventually (after processing ~640 packets) will let the > > user space process run. The latter w

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 18:03 +0200, Paolo Abeni wrote: > If a single core host is under network flood, i.e. ksoftirqd is > scheduled and it eventually (after processing ~640 packets) will let the > user space process run. The latter will execute a syscall to receive a > packet, which will have to d

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Paolo Abeni
Hi, On Tue, 2016-05-10 at 07:29 -0700, Eric Dumazet wrote: > On Tue, 2016-05-10 at 16:11 +0200, Paolo Abeni wrote: > > Currently, the softirq loop can be scheduled both inside the ksofirqd kernel > > thread and inside any running process. This makes nearly impossible for the > > process scheduler

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Thomas Gleixner
On Tue, 10 May 2016, Paolo Abeni wrote: Nice patch set and very promising results! > At this point we are not really sure if we should go with this simpler > approach by putting NAPI itself into kthreads or leverage the threadirqs > function by putting the whole interrupt into a thread and signa

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread David Miller
From: Eric Dumazet Date: Tue, 10 May 2016 07:29:50 -0700 > We already have ksoftirqd to normally cope with the case you are > describing. > > If it is not working as intended, please identify the bugs and fix them, > instead of adding yet another tests in fast path and extra complexity in > the

Re: [RFC PATCH 0/2] net: threadable napi poll loop

2016-05-10 Thread Eric Dumazet
On Tue, 2016-05-10 at 16:11 +0200, Paolo Abeni wrote: > Currently, the softirq loop can be scheduled both inside the ksofirqd kernel > thread and inside any running process. This makes nearly impossible for the > process scheduler to balance in a fair way the amount of time that > a given core spen