From: Pavel Machek <pavel@ucw.cz>
To: Peter Osterlund <petero2@telia.com>
Cc: Pavel Machek <pavel@ucw.cz>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Software suspend testing in 2.6.0-test1
Date: Mon, 21 Jul 2003 14:58:13 +0200 [thread overview]
Message-ID: <20030721125813.GA4775@zaurus.ucw.cz> (raw)
In-Reply-To: <m2u19g9p2c.fsf@telia.com>
Hi!
> > Thanks for a report. If it came with a patch it would be better
> > ;-). I'll take a look.
>
> Here is a patch to make software suspend correctly handle stopped
> processes. It should apply cleanly on top of the patch you sent to
> Linus to decouple SOFTWARE_SUSPEND and ACPI_SLEEP.
>
> @@ -164,14 +164,18 @@
> * Refrigerator and related stuff
> */
>
> -#define INTERESTING(p) > - /* We don't want to touch kernel_threads..*/ > - if (p->flags & PF_IOTHREAD) > - continue; > - if (p == current) > - continue; > - if (p->state == TASK_ZOMBIE) > - continue;
> +/* 0 = Ignore this process when freezing/thawing, 1 = freeze/thaw this process */
> +static inline int interesting_process(struct task_struct *p)
> +{
> + if (p->flags & PF_IOTHREAD)
> + return 0;
> + if (p == current)
> + return 0;
> + if ((p->state == TASK_ZOMBIE) || (p->state == TASK_DEAD))
> + return 0;
> +
> + return 1;
> +}
>
Simple cleanup, okay.
> @@ -214,9 +218,12 @@
> read_lock(&tasklist_lock);
> do_each_thread(g, p) {
> unsigned long flags;
> - INTERESTING(p);
> + if (!interesting_process(p))
> + continue;
> if (p->flags & PF_FROZEN)
> continue;
> + if (p->state == TASK_STOPPED)
> + continue;
>
> /* FIXME: smp problem here: we may not access other process' flags
> without locking */
No need to handle TASK_STOPPED tasks, as they are "frozen" already. Ok.
> read_lock(&tasklist_lock);
> do_each_thread(g, p) {
> - INTERESTING(p);
> -
> - if (p->flags & PF_FROZEN) p->flags &= ~PF_FROZEN;
> - else
> - printk(KERN_INFO " Strange, %s not stopped\n", p->comm );
> - wake_up_process(p);
> + if (!interesting_process(p))
> + continue;
> +
> + p->flags &= ~PF_FREEZE;
> + if (p->flags & PF_FROZEN) {
> + p->flags &= ~PF_FROZEN;
> + wake_up_process(p);
> + } else
> +
But why do you touch PF_FROZEN here? Refrigerator should do that.
And wake_up_process should not be needed...
If it is in refrigerator, it polls PF_FREEZE...
--
Pavel
Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...
next prev parent reply other threads:[~2003-07-21 12:47 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-17 19:46 Software suspend testing in 2.6.0-test1 Peter Osterlund
2003-07-17 20:00 ` Pavel Machek
2003-07-17 20:09 ` Andrew Morton
2003-07-18 9:59 ` Peter Osterlund
2003-07-18 10:24 ` Andrew Morton
2003-07-18 15:22 ` Pavel Machek
2003-07-18 15:55 ` Peter Osterlund
2003-07-18 16:45 ` Andrew Morton
2003-07-18 17:50 ` Pavel Machek
2003-07-18 18:02 ` Patrick Mochel
2003-07-18 18:04 ` Pavel Machek
2003-07-18 21:05 ` Nigel Cunningham
2003-07-18 19:37 ` Andrew Morton
2003-07-18 19:58 ` Peter Osterlund
2003-07-18 20:15 ` Andrew Morton
2003-07-18 22:13 ` Pavel Machek
2003-07-20 0:22 ` Peter Osterlund
2003-07-20 1:01 ` Andrew Morton
2003-07-20 7:45 ` Peter Osterlund
2003-07-18 21:05 ` Nigel Cunningham
2003-07-21 10:00 ` Peter Osterlund
2003-07-21 12:58 ` Pavel Machek [this message]
2003-07-21 14:36 ` Peter Osterlund
2003-07-21 21:28 ` Pavel Machek
2003-07-21 23:46 ` Peter Osterlund
2003-07-22 11:04 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030721125813.GA4775@zaurus.ucw.cz \
--to=pavel@ucw.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=petero2@telia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).