[CRIU] [PATCH 1/3] page-pipe: allow to handle pipes in batch mode

Andrey Wagin avagin at gmail.com
Thu Jan 30 00:21:20 PST 2014


2014-01-30 Pavel Emelyanov <xemul at parallels.com>:
> On 01/30/2014 12:12 AM, Andrew Vagin wrote:
>> On Wed, Jan 29, 2014 at 05:13:23PM +0400, Pavel Emelyanov wrote:
>>> On 01/27/2014 06:22 PM, Andrey Vagin wrote:
>>>> The problem is that vmsplice() to a big pipe fails very often.
>>>>
>>>> The kernel allocates the linear chunk of memory for pipe buffer
>>>> descriptos, but big allocation in kernel can fail.
>>>>
>>>> So we need to restrict maximal capacity of pipes. But the number of
>>>> pipes is restricted too, so we need to dump memory in a batch mode.
>>>
>>> Batch mode means "several at once". Do you mean "... using one pipe"?
>>
>> I mean match mode "several at once" ;).
>
> Then current mode is batch also -- it pulls several pages into several
> pipes and dumps them all at once.

The current mode does one iteration per process. The number of pipes
is not limited.

Pavel, pls look at the next patch, it starts to use this code.

>
>>>
>>>> TODO: send all pipes to parasite in one request
>>>> Signed-off-by: Andrey Vagin <avagin at openvz.org>
>>>> ---
>>>>  include/page-pipe.h |  14 ++++++++
>>>>  page-pipe.c         | 100 +++++++++++++++++++++++++++++++++++++++++++++++++---
>>>>  2 files changed, 110 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/include/page-pipe.h b/include/page-pipe.h
>>>> index 393627b..78c66b2 100644
>>>> --- a/include/page-pipe.h
>>>> +++ b/include/page-pipe.h
>>>> @@ -78,6 +78,9 @@ struct page_pipe_buf {
>>>>     struct list_head l;     /* links into page_pipe->bufs */
>>>>  };
>>>>
>>>> +struct page_pipe;
>>>> +typedef int (page_pipe_batch_cb)(struct page_pipe *pp, void *args);
>>>> +
>>>>  struct page_pipe {
>>>>     unsigned int nr_pipes;  /* how many page_pipe_bufs in there */
>>>>     struct list_head bufs;  /* list of bufs */
>>>> @@ -89,6 +92,12 @@ struct page_pipe {
>>>>     unsigned int nr_holes;  /* number of holes allocated */
>>>>     unsigned int free_hole; /* number of holes in use */
>>>>     struct iovec *holes;    /* holes */
>>>> +
>>>> +   unsigned int pipe_max_size; /* max allowable pipe capacity */
>>>
>>> This thing is effectively constant. Make it such, please.
>>
>> Ok
>>
>>>
>>>> +   int pipe_nr;            /* number of avaliable pipes */
>>>
>>> Available where? Each page-pipe carries nr_pipes pipe bufs. What is
>>> the new number about?
>>
>> Available for one batch
>
> How does it differ from nr_pipes?

We creates ppd while we have avaliable pipes, if we don't have, we
start to handle existent ppd-s and so on.

>
>>>
>>>> +
>>>> +   page_pipe_batch_cb *batch_cb; /* callback to handle batch requests */
>>>> +   void *batch_args;       /* arguments for the callback */
>>>>  };
>>>>
>>>>  extern struct page_pipe *create_page_pipe(unsigned int nr, struct iovec *);
>> .
>>
>
>


More information about the CRIU mailing list