[CRIU] Re: [PATCH 4/8] restore: socket queues support

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Feb 28 06:42:16 EST 2012


28.02.2012 15:40, Pavel Emelyanov пишет:
>> +static int read_sockets_queues(int fd, struct list_head *packets_list)
>> +{
>> +	struct sk_packet *pkt;
>> +	int ret;
>> +
>> +	pr_info("Trying to read socket queue\n");
>> +
>> +	lseek(fd, MAGIC_OFFSET, SEEK_SET);
>> +	while (1) {
>> +		struct sk_packet_entry tmp;
>> +		struct sk_packet_entry *entry;
>> +
>> +		ret = read_img_eof(fd,&tmp);
>> +		if (ret<= 0)
>> +			goto out;
>> +
>> +		pkt = xmalloc(sizeof(*pkt) + tmp.length);
> That's bad idea. Socket queues can be VERY big. Better to collect in memory
> small structures with file offsets where the data lies. And then use splice
> to read the bits from file to socket buffer ;)

Gmmm. Ok, splice sounds good.

-- 
Best regards,
Stanislav Kinsbursky




More information about the CRIU mailing list