From: Cyrill Gorcunov <gorcu...@virtuozzo.com> To restore big slabs of memory (more than 1G) via pipes we need pipes to be able to carry such sizes, for this sake Andrey propose to use kvcalloc calls. Looking into the code I didn't find a reason why we can't do so, thus here is a patch.
https://jira.sw.ru/browse/PSBM-69201 CC: Andrey Vagin <ava...@virtuozzo.com> CC: Andrey Ryabinin <aryabi...@virtuozzo.com> CC: Konstantin Khorenko <khore...@virtuozzo.com> CC: "Denis V. Lunev" <d...@virtuozzo.com> Signed-off-by: Cyrill Gorcunov <gorcu...@virtuozzo.com> Rebase to vz8 - Change kvmalloc to kvcalloc to respect mainline kmalloc->kcalloc change - Rename patch "Use kvmalloc..." -> "Use kvcalloc..." (cherry-picked from 606b246f934c826673c95c4e6504ff1cad83fe9f) Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> --- fs/pipe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index cac019c..90de2ee 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -646,7 +646,7 @@ struct pipe_inode_info *alloc_pipe_info(void) if (too_many_pipe_buffers_hard(user_bufs) && is_unprivileged_user()) goto out_revert_acct; - pipe->bufs = kcalloc(pipe_bufs, sizeof(struct pipe_buffer), + pipe->bufs = kvcalloc(pipe_bufs, sizeof(struct pipe_buffer), GFP_KERNEL_ACCOUNT); if (pipe->bufs) { @@ -679,7 +679,7 @@ void free_pipe_info(struct pipe_inode_info *pipe) } if (pipe->tmp_page) __free_page(pipe->tmp_page); - kfree(pipe->bufs); + kvfree(pipe->bufs); kfree(pipe); } @@ -1089,7 +1089,7 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg) goto out_revert_acct; } - bufs = kcalloc(nr_pages, sizeof(*bufs), + bufs = kvcalloc(nr_pages, sizeof(*bufs), GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (unlikely(!bufs)) { ret = -ENOMEM; @@ -1118,7 +1118,7 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg) } pipe->curbuf = 0; - kfree(pipe->bufs); + kvfree(pipe->bufs); pipe->bufs = bufs; pipe->buffers = nr_pages; return nr_pages * PAGE_SIZE; -- 1.8.3.1 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel