Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71114
b: refs/heads/master
c: 438e2ce
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Oct 18, 2007
1 parent 6daf578 commit e12090f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b842ee578eeb2c10303725e28edca130ede0397c
refs/heads/master: 438e2ce68dfd4af4cfcec2f873564fb921db4bb5
18 changes: 15 additions & 3 deletions trunk/kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ static int try_to_freeze_tasks(int freeze_user_space)
struct task_struct *g, *p;
unsigned long end_time;
unsigned int todo;
struct timeval start, end;
s64 elapsed_csecs64;
unsigned int elapsed_csecs;

do_gettimeofday(&start);

end_time = jiffies + TIMEOUT;
do {
Expand All @@ -194,17 +199,21 @@ static int try_to_freeze_tasks(int freeze_user_space)
break;
} while (todo);

do_gettimeofday(&end);
elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
do_div(elapsed_csecs64, NSEC_PER_SEC / 100);
elapsed_csecs = elapsed_csecs64;

if (todo) {
/* This does not unfreeze processes that are already frozen
* (we have slightly ugly calling convention in that respect,
* and caller must call thaw_processes() if something fails),
* but it cleans up leftover PF_FREEZE requests.
*/
printk("\n");
printk(KERN_ERR "Freezing of %s timed out after %d seconds "
printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
"(%d tasks refusing to freeze):\n",
freeze_user_space ? "user space " : "tasks ",
TIMEOUT / HZ, todo);
elapsed_csecs / 100, elapsed_csecs % 100, todo);
show_state();
read_lock(&tasklist_lock);
do_each_thread(g, p) {
Expand All @@ -215,6 +224,9 @@ static int try_to_freeze_tasks(int freeze_user_space)
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
} else {
printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
elapsed_csecs % 100);
}

return todo ? -EBUSY : 0;
Expand Down

0 comments on commit e12090f

Please sign in to comment.