Re: [PATCH 2/2] blktrace: limit allowed total trace buffer size
From: Christoph Hellwig
Date: Tue Mar 30 2021 - 12:58:12 EST
On Tue, Mar 23, 2021 at 04:14:40PM +0800, Ming Lei wrote:
> On some ARCHs, such as aarch64, page size may be 64K, meantime there may
Which we call arm64..
> be lots of CPU cores. relay_open() needs to allocate pages on each CPU
> blktrace, so easily too many pages are taken by blktrace. For example,
> on one ARM64 server: 224 CPU cores, 16G RAM, blktrace finally got
> allocated 7GB in case of 'blktrace -b 8192' which is used by device-mapper
> test suite[1]. This way could cause OOM easily.
>
> Fix the issue by limiting max allowed pages to be 1/8 of totalram_pages().
Doesn't this break the blktrace ABI by using different buffer size
and numbers than the user asked for? I think we can enforce an
upper limit and error out, but silently adjusting seems wrong.
Wouldn't it make more sense to fix userspace to not request so many
and so big buffers instead?