Linux kernel source tree
Go to file
Daniel Jordan 4d83de6da2 vfio/type1: Batch page pinning
Pinning one 4K page at a time is inefficient, so do it in batches of 512
instead.  This is just an optimization with no functional change
intended, and in particular the driver still calls iommu_map() with the
largest physically contiguous range possible.

Add two fields in vfio_batch to remember where to start between calls to
vfio_pin_pages_remote(), and use vfio_batch_unpin() to handle remaining
pages in the batch in case of error.

qemu pins pages for guests around 8% faster on my test system, a
two-node Broadwell server with 128G memory per node.  The qemu process
was bound to one node with its allocations constrained there as well.

                             base               test
          guest              ----------------   ----------------
       mem (GB)   speedup    avg sec    (std)   avg sec    (std)
              1      7.4%       0.61   (0.00)      0.56   (0.00)
              2      8.3%       0.93   (0.00)      0.85   (0.00)
              4      8.4%       1.46   (0.00)      1.34   (0.00)
              8      8.6%       2.54   (0.01)      2.32   (0.00)
             16      8.3%       4.66   (0.00)      4.27   (0.01)
             32      8.3%       8.94   (0.01)      8.20   (0.01)
             64      8.2%      17.47   (0.01)     16.04   (0.03)
            120      8.5%      32.45   (0.13)     29.69   (0.01)

perf diff confirms less time spent in pup.  Here are the top ten
functions:

             Baseline  Delta Abs  Symbol

               78.63%     +6.64%  clear_page_erms
                1.50%     -1.50%  __gup_longterm_locked
                1.27%     -0.78%  __get_user_pages
                          +0.76%  kvm_zap_rmapp.constprop.0
                0.54%     -0.53%  vmacache_find
                0.55%     -0.51%  get_pfnblock_flags_mask
                0.48%     -0.48%  __get_user_pages_remote
                          +0.39%  slot_rmap_walk_next
                          +0.32%  vfio_pin_map_dma
                          +0.26%  kvm_handle_hva_range
                ...

Suggested-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2021-02-22 16:30:47 -07:00
Documentation x86: 2021-02-21 13:31:43 -08:00
LICENSES
arch x86: 2021-02-21 13:31:43 -08:00
block for-5.12/block-2021-02-17 2021-02-21 11:02:48 -08:00
certs
crypto
drivers vfio/type1: Batch page pinning 2021-02-22 16:30:47 -07:00
fs x86: 2021-02-21 13:31:43 -08:00
include Merge commit '3e10585335b7967326ca7b4118cada0d2d00a2ab' into v5.12/vfio/next 2021-02-22 10:14:24 -07:00
init Scheduler updates for v5.12: 2021-02-21 12:35:04 -08:00
ipc
kernel x86: 2021-02-21 13:31:43 -08:00
lib Scheduler updates for v5.12: 2021-02-21 12:35:04 -08:00
mm x86: 2021-02-21 13:31:43 -08:00
net Highlights: 2021-02-21 10:22:20 -08:00
samples
scripts These are the v5.12 updates for the locking subsystem: 2021-02-21 12:12:01 -08:00
security
sound - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
tools x86: 2021-02-21 13:31:43 -08:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS - added support for Nintendo N64 2021-02-21 13:18:26 -08:00
Makefile
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.