From: Andrei Vagin <avagin@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <christian.brauner@ubuntu.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Dmitry Safonov <0x7f454c46@gmail.com>
Subject: Re: [PATCH] fs/pipe: use kvcalloc to allocate a pipe_buffer array
Date: Mon, 24 Jan 2022 19:21:44 -0800 [thread overview]
Message-ID: <CANaxB-x83ZUSw493feutgF4_sBD7Uj_p0VwNxpmaq1u7eMsq-w@mail.gmail.com> (raw)
In-Reply-To: <20220104171058.22580-1-avagin@gmail.com>
On Tue, Jan 4, 2022 at 9:11 AM Andrei Vagin <avagin@gmail.com> wrote:
>
> Right now, kcalloc is used to allocate a pipe_buffer array. The size of
> the pipe_buffer struct is 40 bytes. kcalloc allows allocating reliably
> chunks with sizes less or equal to PAGE_ALLOC_COSTLY_ORDER (3). It means
> that the maximum pipe size is 3.2MB in this case.
>
> In CRIU, we use pipes to dump processes memory. CRIU freezes a target
> process, injects a parasite code into it and then this code splices
> memory into pipes. If a maximum pipe size is small, we need to
> do many iterations or create many pipes.
>
> kvcalloc attempt to allocate physically contiguous memory, but upon
> failure, fall back to non-contiguous (vmalloc) allocation and so it
> isn't limited by PAGE_ALLOC_COSTLY_ORDER.
>
> The maximum pipe size for non-root users is limited by
> the /proc/sys/fs/pipe-max-size sysctl that is 1MB by default, so only
> the root user will be able to trigger vmalloc allocations.
>
> Cc: Dmitry Safonov <0x7f454c46@gmail.com>
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
Alexander and Andrew,
Do you have any objections? Could you merge this patch?
Dmitry's comments have been addressed in the separate patch:
https://lkml.org/lkml/2022/1/6/463
BTW: I found that fuse already uses kvmalloc to allocate pipe buffers
(e. g. fuse_dev_splice_read).
Thanks,
Andrei
prev parent reply other threads:[~2022-01-25 4:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 17:10 [PATCH] fs/pipe: use kvcalloc to allocate a pipe_buffer array Andrei Vagin
2022-01-05 6:54 ` Dmitry Safonov
2022-01-05 21:47 ` Andrei Vagin
2022-01-05 22:50 ` Dmitry Safonov
2022-01-06 17:37 ` Dmitry Safonov
2022-01-25 3:21 ` Andrei Vagin [this message]
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=CANaxB-x83ZUSw493feutgF4_sBD7Uj_p0VwNxpmaq1u7eMsq-w@mail.gmail.com \
--to=avagin@gmail.com \
--cc=0x7f454c46@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=christian.brauner@ubuntu.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).