diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-07-17 14:15:47 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-07-18 14:19:53 +0200 |
commit | 6301cb95c119ebf324bb96ee226fa9ddffad80a7 (patch) | |
tree | 7201f406d135212bae3775dc7d71cbdd6990e5de /kernel/freezer.c | |
parent | a468d389349a7560249b355cdb6d2097ea1616c9 (diff) | |
download | linux-stable-6301cb95c119ebf324bb96ee226fa9ddffad80a7.tar.gz linux-stable-6301cb95c119ebf324bb96ee226fa9ddffad80a7.tar.bz2 linux-stable-6301cb95c119ebf324bb96ee226fa9ddffad80a7.zip |
sched: fix nr_uninterruptible accounting of frozen tasks really
commit e3c8ca8336 (sched: do not count frozen tasks toward load) broke
the nr_uninterruptible accounting on freeze/thaw. On freeze the task
is excluded from accounting with a check for (task->flags &
PF_FROZEN), but that flag is cleared before the task is thawed. So
while we prevent that the task with state TASK_UNINTERRUPTIBLE
is accounted to nr_uninterruptible on freeze we decrement
nr_uninterruptible on thaw.
Use a separate flag which is handled by the freezing task itself. Set
it before calling the scheduler with TASK_UNINTERRUPTIBLE state and
clear it after we return from frozen state.
Cc: <stable@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/freezer.c')
-rw-r--r-- | kernel/freezer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/freezer.c b/kernel/freezer.c index 2f4936cf7083..bd1d42b17cb2 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -44,12 +44,19 @@ void refrigerator(void) recalc_sigpending(); /* We sent fake signal, clean it up */ spin_unlock_irq(¤t->sighand->siglock); + /* prevent accounting of that task to load */ + current->flags |= PF_FREEZING; + for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); if (!frozen(current)) break; schedule(); } + + /* Remove the accounting blocker */ + current->flags &= ~PF_FREEZING; + pr_debug("%s left refrigerator\n", current->comm); __set_current_state(save); } |