Sukadev Bhattiprolu wrote: > Oren Laadan [orenl@xxxxxxxxxxxxxxx] wrote: > | From ee2f3b5c8548136229cc2f41c5271b0a81ab8a4d Mon Sep 17 00:00:00 2001 > | From: Oren Laadan <orenl@xxxxxxxxxxxxxxx> > | Date: Mon, 30 Mar 2009 15:06:13 -0400 > | Subject: [PATCH 14/29] Checkpoint multiple processes [...] > | +/* count number of tasks in tree (and optionally fill pid's in array) */ > | +static int cr_tree_count_tasks(struct cr_ctx *ctx) > | +{ > | + struct task_struct *root = ctx->root_task; > | + struct task_struct *task = root; > | + struct task_struct *parent = NULL; > | + struct task_struct **tasks_arr = ctx->tasks_arr; > | + int tasks_nr = ctx->tasks_nr; > | + int nr = 0; > | + > | + read_lock(&tasklist_lock); > | + > | + /* count tasks via DFS scan of the tree */ > | + while (1) { > | + if (tasks_arr) { > | + /* unlikely... but if so then try again later */ > | + if (nr == tasks_nr) { > | + nr = -EAGAIN; /* cleanup in cr_ctx_free() */ > | + break; > | + } > | + tasks_arr[nr] = task; > | + get_task_struct(task); > > Can we do an early cr_may_checkpoint_task() here ? Sure, moved the test to here. Oren. > > Sukadev > _______________________________________________ Containers mailing list Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/containers