SCHED_BATCH not stopped (swsusp fails)
Subsystems (2)
SCHED_BATCH processes dont seem to heed the `stop' request (order?) by swsusp. I run httpd and mysqld (for my wiki page) with SCHED_BATCH (so that I can work on my computer even if the load is very high) but when I try to suspend the system, it tries to stop the tasks and simply returns. Here is the dmesg output (paritial)
#dmesg
....
....
Stopping tasks: =======================================
stopping tasks failed (20 tasks remaining)
Restarting tasks...<6> Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
Strange, httpd not stopped
done
===================
Signature · 1 line
Rajsekar
Hi!
Quoted 5 lines
SCHED_BATCHprocesses dont seem to heed the `stop' request (order?) by swsusp. I run httpd and mysqld (for my wiki page) withSCHED_BATCH(so that I can work on my computer even if the load is very high) but when I try to suspend the system, it tries to stop the tasks and simply returns. Here is the dmesg output (paritial)
Aha, so if it mysqld is not running SCHED_BATCH priority, stopping mysqld will work ok?
Pavel
Quoted 9 lines
#dmesg
....
....
Stopping tasks: =======================================
stopping tasks failed (20 tasks remaining)
Restarting tasks...<6> Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Strange, mysqld not stopped
Signature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
Quoted 10 lines · Pavel Machek
Hi!
Quoted 5 lines
SCHED_BATCHprocesses dont seem to heed the `stop' request (order?) by swsusp. I run httpd and mysqld (for my wiki page) withSCHED_BATCH(so that I can work on my computer even if the load is very high) but when I try to suspend the system, it tries to stop the tasks and simply returns. Here is the dmesg output (paritial)
Quoted 2 lines
Aha, so if it mysqld is not running
SCHED_BATCHpriority, stopping mysqld will work ok?
That makes sense.
Sorry, SCHED_BATCH is unique to my tree at the moment so this is my mistake for not considering it. I'll have to transiently schedule SCHED_BATCH tasks as SCHED_NORMAL if we are going into swsusp. It's something I'll have to work on. In the interim, a workaround would be to convert all httpd threads to SCHED_NORMAL before shutting down in your scripts somewhere and convert them back after resuming.
Cheers,
Con
P.S. Raj the --cutme-- thing in your email is very annoying for those of us who reply to up to 300 emails a day (and yes I do know why you do it, but if you keep doing it people will stop replying directly to you).
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 56 lines · Con Kolivas
Quoted 34 lines · Rajsekar
Quoted 23 lines · Pavel Machek
Hi!
Quoted 20 lines
Quoted 9 lines
Quoted 5 lines
SCHED_BATCHprocesses dont seem to heed the `stop' request (order?) by swsusp. I run httpd and mysqld (for my wiki page) withSCHED_BATCH(so that I can work on my computer even if the load is very high) but when I try to suspend the system, it tries to stop the tasks and simply returns. Here is the dmesg output (paritial)Aha, so if it mysqld is not running
SCHED_BATCHpriority, stopping mysqld will work ok?That makes sense.
Sorry,
SCHED_BATCHis unique to my tree at the moment so this is my mistake for not considering it. I'll have to transiently scheduleSCHED_BATCHtasks asSCHED_NORMALif we are going into swsusp. It's something I'll have to work on. In the interim, a workaround would be to convert all httpd threads toSCHED_NORMALbefore shutting down in your scripts somewhere and convert them back after resuming.Cheers,
ConQuoted 9 lines
Quoted 2 lines
P.S. Raj the --cutme-- thing in your email is very annoying for those of us who reply to up to 300 emails a day (and yes I do know why you do it, but if you keep doing it people will stop replying directly to you).Seconded. And by now your email address is in l-k, so you might simply give it up :-).
PavelSignature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!Quoted 3 lines
Can you give me some ideas on how to go about it? Or why exactly
SCHED_BATCHdoes not respond to SIGSTOP (is it because of UNINTERRUPTIBLE sleep)?I'm trying a patch to help it work properly; I haven't been able to test it. It is going into ck3. If you want you can try just that patch on your current kernel or download ck3.
The small patch is attached.
Cheers,
ConIndex:
linux-2.6.10-ck3/kernel/power/process.c
===================================================================kernel/power/process.c +0
-0@@ -68,6 +68,12 @@ int freeze_processes(void)read_lock (&tasklist_lock); do_each_thread(g, p) {
kernel/power/process.c int freeze_processes(void) · line 79
Quoted 10 lines
kernel/power/process.c +6
-0unsigned long flags; +if (batch_task (p)) + p->flags |=PF_UISLEEP ; +/* +* This will make batch tasks run SCHED_NORMAL +* too allow them to be frozen. +*/ if (!freezeable (p))continue ; if ((p->flags & PF_FROZEN) ||
Your patch did not solve the problem.
The problem is that after you set the PF_UISLEEP flag, but no where else is it checked. My idea is to ignore freezing the PF_UISLEEP processes (hoping they wont wake up in the mean time) and just adding another condition. I had add just one more line of code to make it work. May be that it has been added in swsusp and mine is out of date.
Could you tell me if what I have done is right?
kernel/power/process.c +7 -0
@@ -23,6 +23,7 @@ { if ((p == current) || (p->flags & PF_NOFREEZE) || + (p->flags & PF_UISLEEP) || (p->exit_state == EXIT_ZOMBIE) || (p->exit_state == EXIT_DEAD) || (p->state == TASK_STOPPED) ||
@@ -68,6 +69,12 @@read_lock (&tasklist_lock); do_each_thread(g, p) {unsigned long flags; +if (batch_task (p)) + p->flags |=PF_UISLEEP ; +/* +* This will make batch tasks run SCHED_NORMAL +* too allow them to be frozen. +*/ if (!freezeable (p))continue ; if ((p->flags & PF_FROZEN) ||
Signature · 3 lines
--
Rajsekar Manokaran
IIT MadrasQuoted 82 lines · Rajsekar
Quoted 60 lines · Con Kolivas
Quoted 37 lines · Rajsekar
Quoted 24 lines · Pavel Machek
Hi!
Quoted 20 lines
Quoted 9 lines
Quoted 5 lines
SCHED_BATCHprocesses dont seem to heed the `stop' request (order?) by swsusp. I run httpd and mysqld (for my wiki page) withSCHED_BATCH(so that I can work on my computer even if the load is very high) but when I try to suspend the system, it tries to stop the tasks and simply returns. Here is the dmesg output (paritial)Aha, so if it mysqld is not running
SCHED_BATCHpriority, stopping mysqld will work ok?That makes sense.
Sorry,
SCHED_BATCHis unique to my tree at the moment so this is my mistake for not considering it. I'll have to transiently scheduleSCHED_BATCHtasks asSCHED_NORMALif we are going into swsusp. It's something I'll have to work on. In the interim, a workaround would be to convert all httpd threads toSCHED_NORMALbefore shutting down in your scripts somewhere and convert them back after resuming.Cheers,
ConQuoted 9 lines
Quoted 2 lines
P.S. Raj the --cutme-- thing in your email is very annoying for those of us who reply to up to 300 emails a day (and yes I do know why you do it, but if you keep doing it people will stop replying directly to you).Seconded. And by now your email address is in l-k, so you might simply give it up :-).
PavelSignature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!Quoted 3 lines
Can you give me some ideas on how to go about it? Or why exactly
SCHED_BATCHdoes not respond to SIGSTOP (is it because of UNINTERRUPTIBLE sleep)?I'm trying a patch to help it work properly; I haven't been able to test it. It is going into ck3. If you want you can try just that patch on your current kernel or download ck3.
The small patch is attached.
Cheers,
ConIndex:
linux-2.6.10-ck3/kernel/power/process.c
===================================================================kernel/power/process.c +0
-0@@ -68,6 +68,12 @@ int freeze_processes(void)read_lock (&tasklist_lock); do_each_thread(g, p) {kernel/power/process.c int freeze_processes(void) · line 79
Quoted 10 lines
kernel/power/process.c +6
-0unsigned long flags; +if (batch_task (p)) + p->flags |=PF_UISLEEP ; +/* +* This will make batch tasks run SCHED_NORMAL +* too allow them to be frozen. +*/ if (!freezeable (p))continue ; if ((p->flags & PF_FROZEN) ||Your patch did not solve the problem.
The problem is that after you set thePF_UISLEEPflag, but no where else is it checked. My idea is to ignore freezing thePF_UISLEEPprocesses (hoping they wont wake up in the mean time) and just adding another condition. I had add just one more line of code to make it work. May be that it has been added in swsusp and mine is out of date.
Quoted 1 line
Could you tell me if what I have done is right?
Adding the UISLEEP flag was just reusing a flag that is unique in the staircase cpu scheduler and makes SCHED_BATCH run as SCHED_NORMAL next timeslice (it is used to prevent DoSing with held semaphores from SCHED_BATCH). Unfortunately it doesn't seem to make them SCHED_NORMAL long enough to run for a bit and then be frozen by swsusp. The batch tasks do need to be frozen like the rest. What you are doing is making swsusp not even try to freeze SCHED_BATCH processes. I suspect this is dangerous as you'll lose data to a suspend by ignoring processes that are actually running.
I still don't have time to study the swsusp code much more to figure out how to do this properly.
You can still do it in userspace for httpd2 for example with for i in /sbin/pidof httpd2
do
schedtool -N $i
done
to convert them to SCHED_NORMAL in your swsusp scripts before it tries to suspend, and then on wakeup do:
for i in /sbin/pidof httpd2
do
schedtool -B $i
done
Cheers,
Con