[CRIU] [PATCH 06/19] pstree: Bind CoreEntry to pstree item

Pavel Emelyanov xemul at parallels.com
Wed Feb 27 08:15:57 EST 2013


On 02/27/2013 05:00 PM, Cyrill Gorcunov wrote:
> On Wed, Feb 27, 2013 at 04:21:59PM +0400, Pavel Emelyanov wrote:
>>>>
>>>> why not simply pull threads regs in the same manner?
>>>
>>> Could you please enlight me here? 
>>
>> My question is -- we do have code, that fetches regs for master threads
>> at some time in the dump beginning. Why do we need some complex code
>> rework to fetch sub-threads regs as well in the same place?
> 
> Hmm. Lets double check.
> 
> 1) Before this set we fetch task registers in two places
> 
> dump_task_core_all
>   get_task_regs(pid, core, ctl);
> 
> 	Here we save thread leader registers, which are
> 	cached in ctl variable from parasite injection
> 	code
> 
> dump_task_thread
>   get_task_regs(pid, core, NULL)
> 
> 	Here we save them for every thread but the leader
> 
> Bot helpers dump_task_core_all and dump_task_thread are
> caller after parasite being injected.
> 
> With this set applied, we save all registers right after
> the dumpee threads (all threads) are seized but parasite
> is not yet injected. So the only oddity in new code I see
> it that we will have a redundant copy of registers for
> thread leader, but overall picture become more clear
> 
> collect threads
>   seize them
>     fetch registers
> 
> so I think it's rather a benefit, and it only looks
> complex becuase of patch itself, in resulting code
> it should be more clear. Agreed?

No.

1. Don't make two copies of registers
2. If you need to make N actions over a list of pstree-items,
   do it in the

   for_each_pstree()
	action_1()
	action_2()
	...
	action_N()

manner, not the

	for_each_pstree()
		action_1()

	for_each_pstree()
		action_2()

	...

	for_each_pstree()
		action_N()

one.

> .
> 

Is item 2) missed?

Thanks,
Pavel


More information about the CRIU mailing list