Re: [PATCH 2/4] swsusp: Untangle freeze_processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> Move the loop from freeze_processes() to a separate function and call it
> independently for user space processes and kernel threads so that the order of
> freezing tasks is clearly visible.
> 
> Signed-off-by: Rafael J. Wysocki <[email protected]>
> ---
>  kernel/power/process.c |   88 ++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 58 insertions(+), 30 deletions(-)
>

>  		do_each_thread(g, p) {
> +			if (is_user_space(p)) {
> +				if(!freeze_user_space)
> +					continue;
> +			} else {
> +				if(freeze_user_space)
> +					continue;
> +			}

Needs space between if and (, but lets use if (is_user_space() !=
freeze_user_space) trick here, too. 

> +/**
> + *	freeze_processes - tell processes to enter the refrigerator
> + *
> + *	Returns 0 on success, or the number of processes that didn't freeze,
> + *	although they were told to.
> + */

Above you point out to the broken calling convention. Perhaps this is
great time to fix it, too? Hmm, or maybe not. Patch looks good,
otherwise.

							Pavel
> +int freeze_processes(void)
> +{
> +	unsigned int nr_unfrozen;
> +
> +	printk("Stopping tasks ... ");
> +	nr_unfrozen = try_to_freeze_tasks(FREEZER_USER_SPACE);
> +	if (nr_unfrozen)
> +		return nr_unfrozen;
> +
> +	sys_sync();
> +	nr_unfrozen = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
> +	if (nr_unfrozen)
> +		return nr_unfrozen;
> +
>  	printk("done.\n");
>  	BUG_ON(in_atomic());
>  	return 0;

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux