From: Guenter Roeck <linux@roeck-us.net>
To: Keith Busch <kbusch@meta.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
willy@infradead.org, hch@lst.de, tonyb@cybernetics.com,
akpm@linux-foundation.org, kernel-team@meta.com,
Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv4 11/12] dmapool: link blocks across pages
Date: Sun, 26 Feb 2023 16:54:45 -0800 [thread overview]
Message-ID: <20230227005445.GA3425881@roeck-us.net> (raw)
In-Reply-To: <20230126215125.4069751-12-kbusch@meta.com>
Hi,
On Thu, Jan 26, 2023 at 01:51:24PM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
>
> The allocated dmapool pages are never freed for the lifetime of the
> pool. There is no need for the two level list+stack lookup for finding a
> free block since nothing is ever removed from the list. Just use a
> simple stack, reducing time complexity to constant.
>
> The implementation inserts the stack linking elements and the dma handle
> of the block within itself when freed. This means the smallest possible
> dmapool block is increased to at most 16 bytes to accomodate these
> fields, but there are no exisiting users requesting a dma pool smaller
> than that anyway.
>
> Removing the list has a significant change in performance. Using the
> kernel's micro-benchmarking self test:
>
> Before:
>
> # modprobe dmapool_test
> dmapool test: size:16 blocks:8192 time:57282
> dmapool test: size:64 blocks:8192 time:172562
> dmapool test: size:256 blocks:8192 time:789247
> dmapool test: size:1024 blocks:2048 time:371823
> dmapool test: size:4096 blocks:1024 time:362237
>
> After:
>
> # modprobe dmapool_test
> dmapool test: size:16 blocks:8192 time:24997
> dmapool test: size:64 blocks:8192 time:26584
> dmapool test: size:256 blocks:8192 time:33542
> dmapool test: size:1024 blocks:2048 time:9022
> dmapool test: size:4096 blocks:1024 time:6045
>
> The module test allocates quite a few blocks that may not accurately
> represent how these pools are used in real life. For a more marco level
> benchmark, running fio high-depth + high-batched on nvme, this patch
> shows submission and completion latency reduced by ~100usec each, 1%
> IOPs improvement, and perf record's time spent in dma_pool_alloc/free
> were reduced by half.
>
With this patch in linux-next, I see a boot failure when trying to boot
a powernv qemu emulation from the SCSI MEGASAS controller.
Qemu command line is
qemu-system-ppc64 -M powernv -cpu POWER9 -m 2G \
-kernel arch/powerpc/boot/zImage.epapr \
-snapshot \
-device megasas,id=scsi,bus=pcie.0 -device scsi-hd,bus=scsi.0,drive=d0 \
-drive file=rootfs-el.ext2,format=raw,if=none,id=d0 \
-device i82557a,netdev=net0,bus=pcie.1 -netdev user,id=net0 \
-nographic -vga none -monitor null -no-reboot \
--append "root=/dev/sda console=tty console=hvc0"
Reverting this patch together with "dmapool: create/destroy cleanup"
fixes the problem.
Bisect log is attached for reference.
Guenter
---
# bad: [8232539f864ca60474e38eb42d451f5c26415856] Add linux-next specific files for 20230225
# good: [c9c3395d5e3dcc6daee66c6908354d47bf98cb0c] Linux 6.2
git bisect start 'HEAD' 'v6.2'
# good: [fe3130bc4df0b1303de4321af2bc4dcee5d7db2f] cifs: reuse cifs_match_ipaddr for comparison of dstaddr too
git bisect good fe3130bc4df0b1303de4321af2bc4dcee5d7db2f
# good: [8138ddac3c324feb92cc30f6d0d3a1bba51345a9] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git
git bisect good 8138ddac3c324feb92cc30f6d0d3a1bba51345a9
# bad: [2a15ddbcd09ca3a7843a48832884e37e703eaf83] Merge branch 'master' of git://linuxtv.org/media_tree.git
git bisect bad 2a15ddbcd09ca3a7843a48832884e37e703eaf83
# bad: [a7d241d71cf464413307df69177ae2dec8481d37] Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
git bisect bad a7d241d71cf464413307df69177ae2dec8481d37
# bad: [446eb7f1f4aec9232d4b10222123a4566a8b1a95] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git
git bisect bad 446eb7f1f4aec9232d4b10222123a4566a8b1a95
# good: [14c61d2100377dde2f6338395325b4090279d6a7] soc: document merges
git bisect good 14c61d2100377dde2f6338395325b4090279d6a7
# bad: [cb26c07e8a8acaecb43228181e1eae68ece8db0e] Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
git bisect bad cb26c07e8a8acaecb43228181e1eae68ece8db0e
# bad: [d37d53a39d853fcc2121770fd3b61f274985d594] Merge branch 'mm-everything' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
git bisect bad d37d53a39d853fcc2121770fd3b61f274985d594
# bad: [708a06c601945c3415240ed0950e37fe27dd8e60] mm/userfaultfd: support WP on multiple VMAs
git bisect bad 708a06c601945c3415240ed0950e37fe27dd8e60
# good: [beb78ba6c0dbed73b38d5ed74bf47aa2c65fafa7] dmapool: move debug code to own functions
git bisect good beb78ba6c0dbed73b38d5ed74bf47aa2c65fafa7
# bad: [a2cb3f101b06f78258cf0c6813b3a17bd1ec846a] zsmalloc: remove insert_zspage() ->inuse optimization
git bisect bad a2cb3f101b06f78258cf0c6813b3a17bd1ec846a
# good: [e637ac603aec2b0a73e50fd8031481c6e55bf139] dmapool: don't memset on free twice
git bisect good e637ac603aec2b0a73e50fd8031481c6e55bf139
# bad: [8f5073712e32685dfeb4925f13a95c6eb9f10cd8] dmapool: create/destroy cleanup
git bisect bad 8f5073712e32685dfeb4925f13a95c6eb9f10cd8
# bad: [28b0a0c64bc658e176368f9270dc8085aa469c63] dmapool: link blocks across pages
git bisect bad 28b0a0c64bc658e176368f9270dc8085aa469c63
# first bad commit: [28b0a0c64bc658e176368f9270dc8085aa469c63] dmapool: link blocks across pages
next prev parent reply other threads:[~2023-02-27 0:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 21:51 [PATCHv4 00/12] dmapool enhancements Keith Busch
2023-01-26 21:51 ` [PATCHv4 01/12] dmapool: add alloc/free performance test Keith Busch
2023-01-26 21:51 ` [PATCHv4 02/12] dmapool: remove checks for dev == NULL Keith Busch
2023-01-26 21:51 ` [PATCHv4 03/12] dmapool: use sysfs_emit() instead of scnprintf() Keith Busch
2023-01-26 21:51 ` [PATCHv4 04/12] dmapool: cleanup integer types Keith Busch
2023-01-26 21:51 ` [PATCHv4 05/12] dmapool: speedup DMAPOOL_DEBUG with init_on_alloc Keith Busch
2023-01-26 21:51 ` [PATCHv4 06/12] dmapool: move debug code to own functions Keith Busch
2023-01-26 21:51 ` [PATCHv4 07/12] dmapool: rearrange page alloc failure handling Keith Busch
2023-01-26 21:51 ` [PATCHv4 08/12] dmapool: consolidate page initialization Keith Busch
2023-01-26 21:51 ` [PATCHv4 09/12] dmapool: simplify freeing Keith Busch
2023-01-26 21:51 ` [PATCHv4 10/12] dmapool: don't memset on free twice Keith Busch
2023-01-26 21:51 ` [PATCHv4 11/12] dmapool: link blocks across pages Keith Busch
2023-02-01 17:42 ` Bryan O'Donoghue
2023-02-01 17:43 ` Keith Busch
2023-02-02 0:38 ` Bryan O'Donoghue
2023-02-27 0:54 ` Guenter Roeck [this message]
2023-02-28 1:01 ` Keith Busch
2023-02-28 2:18 ` Guenter Roeck
2023-01-26 21:51 ` [PATCHv4 12/12] dmapool: create/destroy cleanup Keith Busch
2023-01-26 22:22 ` [PATCHv4 00/12] dmapool enhancements Andrew Morton
2023-01-27 0:27 ` Keith Busch
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=20230227005445.GA3425881@roeck-us.net \
--to=linux@roeck-us.net \
--cc=akpm@linux-foundation.org \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=tonyb@cybernetics.com \
--cc=willy@infradead.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