Re: [PATCH] fs/pipe: use kvcalloc to allocate a pipe_buffer array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 4, 2022 at 9:11 AM Andrei Vagin <avagin@xxxxxxxxx> 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@xxxxxxxxx>
> Signed-off-by: Andrei Vagin <avagin@xxxxxxxxx>

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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux