[CRIU] Re: [PATCH 3/6] util-net: Add declaration of scm_fdset structure

Cyrill Gorcunov gorcunov at openvz.org
Wed Mar 21 06:54:00 EDT 2012


On Wed, Mar 21, 2012 at 02:40:10PM +0400, Pavel Emelyanov wrote:
> >  
> > +/*
> > + * Because kernel do kmalloc for user data passed
> > + * in SCM messages, and there is SCM_MAX_FD as a limit
> > + * for descriptors passed at once -- we're trying to
> > + * eliminate pressue on kernel memory manager and use
> > + * predefined known to work well size of the message buffer.
> > + */
> > +#define CR_SCM_MSG_SIZE		(1024)
> > +#define CR_SCM_MAX_FD		(252)
> 
> What for 2 constants? Declare one and make the buffer be int[MAX_FD] one.
> 

This won't work. The buffer _must_ include space enough for fds _and_
control message itself. Thus we have two limits here -- one for number
of FDs being passed at once in msg_buf and second for msg_buf itself.

	Cyrill


More information about the CRIU mailing list