Re: [RFC PATCH v3 0/7] ktask: multithread CPU-intensive kernel work
From: Daniel Jordan
Date: Wed Dec 06 2017 - 09:19:41 EST
On 12/05/2017 05:23 PM, Andrew Morton wrote:
On Tue, 5 Dec 2017 14:52:13 -0500 Daniel Jordan <daniel.m.jordan@xxxxxxxxxx> wrote:
This patchset is based on 4.15-rc2 plus one mmots fix[*] and contains three
ktask users:
- deferred struct page initialization at boot time
- clearing gigantic pages
- fallocate for HugeTLB pages
Performance improvements are nice. How much overall impact is there in
real-world worklaods?
All of the users so far are mainly for initialization/startup, so the
impact depends on how often users are rebooting (deferred struct page
init) and starting applications such as RDBMS'es (hugetlbfs_fallocate).
ktask saves 5 seconds of boot time on the two-socket machine I tested on
with deferred init, which is half the time it takes for the kernel to
get to systemd, so for big machines that are frequently updated, the
savings would add up.
Work in progress:
- Parallelizing page freeing in the exit/munmap paths
Also sounds interesting.
Parallelizing this efficiently depends on scaling lru_lock and
zone->lock, which I've been working on separately.
Have you identified any other parallelizable
operations? vfs object teardown at umount time may be one...
By vfs object teardown, are you referring to evict_inodes/dispose_list?
If so, I actually have tried parallelizing that and there were good
speedups during unmount with many cached pages. It's just a matter of
parallelizing well across inodes with different amounts of pages in cache.
I've also gotten good results with __get_user_pages. If we want to keep
the return value of __get_user_pages consistent on error (and I'm
assuming that's a given), there needs to be logic that undoes the work
past the first non-pinned page in the range so we continue to return the
number of pages pinned from the start. That seems ok since it's a slow
path.
The shmem page free path (shmem_undo_range), struct page initialization
on memory hotplug, and huge page copying are others I've considered but
haven't implemented yet.
- CPU hotplug support
Of what? The ktask infrastructure itself?
Yes, ktask itself. When CPUs come up or down, ktask's resource limits
and preallocated data (the struct ktask_work's passed to the workqueue
code) need to be adjusted for the new CPU count, at least as it's
written now.
Thanks for the comments,
Daniel