fuse: use kvmalloc to allocate array of pipe_buffer structs.
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Tue, 17 Jul 2018 16:00:34 +0000 (19:00 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 26 Jul 2018 14:13:12 +0000 (16:13 +0200)
commitd6d931adce1193ef54d06fa9bbf58e5780ca516c
treecc055c3dc51301c32c998a5863dddfe25bd17938
parenta64ba10f65bfe2bead4693ef7fda9f7978dfa162
fuse: use kvmalloc to allocate array of pipe_buffer structs.

The amount of pipe->buffers is basically controlled by userspace by
fcntl(... F_SETPIPE_SZ ...) so it could be large. High order allocations
could be slow (if memory is heavily fragmented) or may fail if the order
is larger than PAGE_ALLOC_COSTLY_ORDER.

Since the 'bufs' doesn't need to be physically contiguous, use
the kvmalloc_array() to allocate memory. If high order
page isn't available, the kvamalloc*() will fallback to 0-order.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c