public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Safonov <dima@arista.com>
To: linux-kernel@vger.kernel.org
Cc: Dmitry Safonov <dima@arista.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Ingo Molnar <mingo@kernel.org>,
	"Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Mauro Carvalho Chehab <mchehab@s-opensource.com>,
	Mike Galbraith <efault@gmx.de>, Paolo Abeni <pabeni@redhat.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Radu Rendec <rrendec@arista.com>, Rik van Riel <riel@redhat.com>,
	Stanislaw Gruszka <sgruszka@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Wanpeng Li <wanpeng.li@hotmail.com>
Subject: [RFC 0/6] Multi-thread per-cpu ksoftirqd
Date: Thu, 18 Jan 2018 16:12:32 +0000	[thread overview]
Message-ID: <20180118161238.13792-1-dima@arista.com> (raw)

Another attempt to solve softirq deferring problems.
There are at least two problems, AFAIK:
o deferring one softirq to ksoftirqd results in latencies for other
  (different type) softirqs by the reason of ksoftirqd_running()
  decision for deferring/servicing.
o The logic in __do_softirq() that checks if (pending) after 2ms of
  processing doesn't work on some machines during i.e. UDP storm.

So, what's done here in attempt to improve this is:
- added boot param to separate softirqs in deffer-groups
- per each softirq-group there is a ksoftirqd (per-cpu also)

The last two patches might be just a brain fart as I tried to improve
the metric on which the decision to defer is based.
I measure the time spent to serve each softirq and account that time
to ksoftirqd thread of that softirq-group. After that the decision
to serve/defer a softirq is based on the comparison:
(current->vruntime < ksoftirqd->vruntime)
Ugh, time measures and updating ksoftirqd cpu time each tick might be
costly.. And it looks like it doesn't work as expected: a new task is
being started with normalized vruntime (min_vruntime), which is lower
than ksoftirqd's. And time spent on servicing softirqs are still bigger
than any running task.
Anyway, sending this as RFC, may be some one will like the approach
(or suggests some other ideas).

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "Levin, Alexander (Sasha Levin)" <alexander.levin@verizon.com> 
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> 
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radu Rendec <rrendec@arista.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Stanislaw Gruszka <sgruszka@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>

Dmitry Safonov (6):
  softirq: Add softirq_groups boot parameter
  softirq: Introduce mask for __do_softirq()
  softirq: Add reverse group-to-softirq map
  softirq: Run per-group per-cpu ksoftirqd thread
  softirq: Add time accounting per-softirq type
  softirq/sched: Account si cpu time to ksoftirqd(s)

 Documentation/admin-guide/kernel-parameters.txt |  16 ++
 include/linux/hardirq.h                         |   2 +-
 include/linux/interrupt.h                       |  26 +-
 include/linux/vtime.h                           |  10 +-
 init/Kconfig                                    |  10 +
 kernel/sched/cputime.c                          |  60 +++-
 kernel/sched/fair.c                             |  38 +++
 kernel/sched/sched.h                            |  20 ++
 kernel/softirq.c                                | 362 ++++++++++++++++++++----
 net/ipv4/tcp_output.c                           |   2 +-
 10 files changed, 464 insertions(+), 82 deletions(-)

-- 
2.13.6

             reply	other threads:[~2018-01-18 16:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 16:12 Dmitry Safonov [this message]
2018-01-18 16:12 ` [RFC 1/6] softirq: Add softirq_groups boot parameter Dmitry Safonov
2018-01-18 16:12 ` [RFC 2/6] softirq: Introduce mask for __do_softirq() Dmitry Safonov
2018-01-18 16:12 ` [RFC 3/6] softirq: Add reverse group-to-softirq map Dmitry Safonov
2018-01-18 16:12 ` [RFC 4/6] softirq: Run per-group per-cpu ksoftirqd thread Dmitry Safonov
2018-01-18 17:00   ` Mike Galbraith
2018-01-18 17:53     ` Dmitry Safonov
2018-01-18 18:28       ` Mike Galbraith
2018-01-18 16:12 ` [RFC 5/6] softirq: Add time accounting per-softirq type Dmitry Safonov
2018-01-18 16:12 ` [RFC 6/6] softirq/sched: Account si cpu time to ksoftirqd(s) Dmitry Safonov

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=20180118161238.13792-1-dima@arista.com \
    --to=dima@arista.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.levin@verizon.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=efault@gmx.de \
    --cc=fweisbec@gmail.com \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@s-opensource.com \
    --cc=mingo@kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rrendec@arista.com \
    --cc=sgruszka@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=wanpeng.li@hotmail.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