linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steffen Klassert <steffen.klassert@secunet.com>
To: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: <linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Eric Biggers <ebiggers@kernel.org>
Subject: Re: RFD: multithreading in padata
Date: Mon, 9 Dec 2019 13:39:29 +0100	[thread overview]
Message-ID: <20191209123929.GQ8621@gauss3.secunet.de> (raw)
In-Reply-To: <20191203155841.56egvxekxgf5xctw@ca-dmjordan1.us.oracle.com>

On Tue, Dec 03, 2019 at 10:58:41AM -0500, Daniel Jordan wrote:
> [resending in modified form since this didn't seem to reach the lists]
> 
> Hi,
> 
> padata has been undergoing some surgery lately[0] and now seems ready for
> another enhancement: splitting up and multithreading CPU-intensive kernel work.
> 
> I'm planning to send an RFC for this, but I wanted to post some thoughts on the
> design and a work-in-progress branch first to see if the direction looks ok.
> 
> Quoting from an earlier series[1], this is the problem I'm trying to solve:
> 
>   A single CPU can spend an excessive amount of time in the kernel operating
>   on large amounts of data.  Often these situations arise during initialization-
>   and destruction-related tasks, where the data involved scales with system
>   size.  These long-running jobs can slow startup and shutdown of applications
>   and the system itself while extra CPUs sit idle.
>       
> There are several paths where this problem exists, but here are three to start:
> 
>  - struct page initialization (at boot-time, during memory hotplug, and for
>    persistent memory)
>  - VFIO page pinning (kvm guest initialization)
>  - fallocating a HugeTLB page (database initialization)
> 
> padata is a general mechanism for parallel work and so seems natural for this
> functionality[2], but now it can only manage a series of small, ordered jobs.
> 
> The coming RFC will bring enhancements to split up a large job among a set of
> helper threads according to the user's wishes, load balance the work between
> them, set concurrency limits to control the overall number of helpers in the
> system and per NUMA node, and run extra helper threads beyond the first at a
> low priority level so as not to disturb other activity on the system for the
> sake of an optimization.  (While extra helpers are run at low priority for most
> of the job, their priority is raised one by one at job end to match the
> caller's to avoid starvation on a busy system.)
> 
> The existing padata interfaces and features will remain, but serialization
> becomes optional because these sorts of jobs don't need it.
> 
> The advantage to enhancing padata rather than having the multithreading stand
> alone is that there would be one central place in the kernel to manage the
> number of helper threads that run at any given time.  A machine's idle CPU
> resources can be harnessed yet controlled (the low priority idea) to provide
> the right amount of multithreading for the system.
> 
> Here's a work-in-progress branch with some of this already done in the last
> five patches.
> 
>     git://oss.oracle.com/git/linux-dmjordan.git padata-mt-wip
>     https://oss.oracle.com/git/gitweb.cgi?p=linux-dmjordan.git;a=shortlog;h=refs/heads/padata-mt-wip
> 
> Thoughts?  Questions?

I'm ok with this. Please consider to add yourself as
a Co-Maintainer, I guess you know the code in between
much better than I do :)


  reply	other threads:[~2019-12-09 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 15:58 RFD: multithreading in padata Daniel Jordan
2019-12-09 12:39 ` Steffen Klassert [this message]
2019-12-09 20:39   ` Daniel Jordan

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=20191209123929.GQ8621@gauss3.secunet.de \
    --to=steffen.klassert@secunet.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=ebiggers@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).