Skip to contentSkip to conversation

threaded application

C/R Sukadev Bhattiprolu 2 participants 2 messages May 17, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Probably premature :-) but tried to C/R a simple threaded application (running as container-init).

First got an -EINVAL due to following check in may_checkpoint_task():

        /*
         * FIX: for now, disallow siblings of container init created
         * via CLONE_PARENT (unclear if they will remain possible)
         */
        if (ctx->root_init && t != ctx->root_task &&
            t->real_parent == ctx->root_task->real_parent)

Assuming we are unintentionally excluding CLONE_THREAD with the above check, I added a check for tgid:

        if (ctx->root_init && t != ctx->root_task &&
            t->real_parent == ctx->root_task->real_parent &&
            t->tgid != ctx->root_task->tgid) {

This got past the -EINVAL but the test failed the ckpt_obj_contained() check.

	c/r: FILE users 2 != count 6 objref 9

The main-thread opened a single file (log file). The other threads don't write to it (yet). The count '6' corresponds to the number of threads in the application.

I suspect that C/R code is incrementing obj->users once per thread for the log file even though the threads share the file_struct reference. (pthread_create() sets CLONE_FILES so the file_struct is shared between threads).

Will post my test programs to Serge's new git-tree next week.

Sukadev

A message that is not in the archive (sent off-list or not yet received): 20090517023125.GA30716-r/[email protected]

#2 lore raw

Suka,

Thanks for the report.

Quoted 12 lines · Sukadev Bhattiprolu

Probably premature :-) but tried to C/R a simple threaded application (running as container-init).

First got an -EINVAL due to following check in may_checkpoint_task():

        /*
         * FIX: for now, disallow siblings of container init created
         * via CLONE_PARENT (unclear if they will remain possible)
         */
        if (ctx->root_init && t != ctx->root_task &&
            t->real_parent == ctx->root_task->real_parent)
Quoted 8 lines

Assuming we are unintentionally excluding CLONE_THREAD with the above check, I added a check for tgid:

        if (ctx->root_init && t != ctx->root_task &&
            t->real_parent == ctx->root_task->real_parent &&
            t->tgid != ctx->root_task->tgid) {

This got past the -EINVAL but the test failed the ckpt_obj_contained() check.

Yes, I see no reason to prevent multi-threaded container init. Will add this to the ckpt-v15-dev git tree.

Quoted 12 lines
	c/r: FILE users 2 != count 6 objref 9

The main-thread opened a single file (log file). The other threads don't write to it (yet). The count '6' corresponds to the number of threads in the application.

I suspect that C/R code is incrementing obj->users once per thread for the log file even though the threads share the file_struct reference. (pthread_create() sets CLONE_FILES so the file_struct is shared between threads).

Indeed, the current code doesn't yet handle files_struct as a shared object, so anything with CLONE_FILES isn't done correctly. That's on the todo-list...

Oren.

Quoted 4 lines

Will post my test programs to Serge's new git-tree next week.

Sukadev