Add missing refrigerator support.
Subsystems (9)
PATCH 1/1 Add missing refrigerator support.
Hi.
Some kernel threads currently lack refrigerator support. This patch fills in the gaps.
Regards,
Nigel
arch/i386/kernel/io_apic.c +2 -0
@@ -571,6 +573,8 @@for ( ; ; ) {set_current_state (TASK_INTERRUPTIBLE ); time_remaining =schedule_timeout (time_remaining); +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (time_after (jiffies, prev_balance_time+balanced_irq_interval)) {do_irq_balance ();
drivers/char/hvc_console.c +1 -0
@@ -270,6 +270,7 @@int i;daemonize ("khvcd" ); + current->flags |=PF_NOFREEZE ;for (;;) {if (cpus_empty (cpus_in_xmon)) {
drivers/ieee1394/nodemgr.c +5 -1
@@ -1482,7 +1481,7 @@if (down_interruptible (&hi->reset_sem) ||down_interruptible (&nodemgr_serialize)) {if (current->flags &PF_FREEZE ) { -refrigerator (0 ); +refrigerator (PF_FREEZE );continue ; }printk ("NodeMgr: received unexpected signal?!\n" );
@@ -1497,6 +1496,10 @@for (i =0 ; i <4 ; i++) {set_current_state (TASK_INTERRUPTIBLE );if (schedule_timeout (HZ /16 )) { +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + }up (&nodemgr_serialize); goto caught_signal; }
drivers/md/md.c +1 -2
@@ -2832,6 +2831,7 @@*/ daemonize (thread->name,mdname (thread->mddev)); + current->flags |=PF_NOFREEZE ; current->exit_signal =SIGCHLD ;allow_signal (SIGKILL );
@@ -2856,8 +2856,6 @@wait_event_interruptible (thread->wqueue,test_bit (THREAD_WAKEUP , &thread->flags)); -if (current->flags &PF_FREEZE ) -refrigerator (PF_FREEZE );clear_bit (THREAD_WAKEUP , &thread->flags);
drivers/media/video/msp3400.c +7 -0
@@ -738,6 +738,7 @@ {DECLARE_WAITQUEUE (wait, current); +again:add_wait_queue (&msp->wq, &wait);if (!msp->rmmod) {set_current_state (TASK_INTERRUPTIBLE );
@@ -747,6 +748,12 @@schedule_timeout (timeout); }remove_wait_queue (&msp->wq, &wait); + +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); + goto again; + } +return msp->rmmod ||signal_pending (current); }
drivers/media/video/tvaudio.c +2 -0
@@ -285,6 +285,8 @@schedule (); }remove_wait_queue (&chip->wq, &wait); +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (chip->done ||signal_pending (current))break ;dprintk ("%s: thread wakeup\n" ,i2c_clientname (&chip->c));
drivers/message/i2o/i2o_block.c +5 -0
@@ -615,6 +615,11 @@ {if (down_interruptible (&i2ob_evt_sem)) { +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + } + evt_running =0 ;printk ("exiting..." );break ;
drivers/message/i2o/i2o_core.c +10 -0
@@ -1027,6 +1027,11 @@ {if (down_interruptible (&evt_sem)) { +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + } +dprintk (KERN_INFO "I2O event thread dead\n" );printk ("exiting..." ); evt_running =0 ;
@@ -1195,6 +1200,11 @@down_interruptible (&c->lct_sem);if (signal_pending (current)) { +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + } +dprintk (KERN_ERR "%s: LCT thread dead\n" , c->name); c->lct_running =0 ;return 0 ;
drivers/net/irda/sir_kthread.c +1 -4
@@ -113,6 +112,7 @@DECLARE_WAITQUEUE (wait, current);daemonize ("kIrDAd" ); + current->flags |=PF_NOFREEZE ; irda_rq_queue.thread = current;
@@ -135,10 +135,6 @@__set_task_state (current,TASK_RUNNING );remove_wait_queue (&irda_rq_queue.kick, &wait); -/* make swsusp happy with our thread */ -if (current->flags &PF_FREEZE ) -refrigerator (PF_FREEZE ); -run_irda_queue (); }
drivers/pnp/pnpbios/core.c +2 -0
@@ -179,6 +179,8 @@*/ set_current_state (TASK_INTERRUPTIBLE );schedule_timeout (HZ *2 ); +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (signal_pending (current))break ;
fs/jffs/intrep.c +5 -0
@@ -3373,6 +3374,11 @@siginfo_t info;unsigned long signr =0 ; +if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + } +spin_lock_irq (¤t->sighand->siglock); signr =dequeue_signal (current, ¤t->blocked, &info);spin_unlock_irq (¤t->sighand->siglock);
fs/lockd/clntlock.c +2 -0
@@ -222,6 +223,8 @@ fl->fl_u.nfs_fl.flags &= ~NFS_LCK_RECLAIM ;nlmclnt_reclaim (host, fl); +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (signalled ())break ; goto restart;
fs/lockd/clntproc.c +2 -0
@@ -310,6 +310,8 @@prepare_to_wait (queue, &wait,TASK_INTERRUPTIBLE );if (!signalled ()) {schedule_timeout (NLMCLNT_GRACE_WAIT ); +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (!signalled ()) status =0 ; }
fs/lockd/svc.c +3 -0
@@ -135,6 +136,9 @@while ((nlmsvc_users || !signalled ()) && nlmsvc_pid == current->pid) {long timeout =MAX_SCHEDULE_TIMEOUT ; +if (current->flags &PF_FREEZE ) +refrigerator (PF_SYNCTHREAD ); +if (signalled ()) {flush_signals (current);if (nlmsvc_ops) {
net/bluetooth/rfcomm/core.c +3 -0
@@ -1738,6 +1738,9 @@schedule (); } +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE ); +/* Process stuff */ clear_bit (RFCOMM_SCHED_WAKEUP , &rfcomm_event);rfcomm_process_sessions ();
net/sunrpc/svcsock.c +2 -0
@@ -1192,6 +1192,8 @@ arg->len = (pages-1 )*PAGE_SIZE ; arg->tail[0 ].iov_len =0 ; +if (current->flags &PF_FREEZE ) +refrigerator (PF_FREEZE );if (signalled ())return -EINTR ;
drivers/ieee1394/nodemgr.c line 1502
Quoted 5 lines · Nigel Cunningham
drivers/ieee1394/nodemgr.c +4
-0+if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + }
This seems excessively verbose. Why not do:
if (try_to_freeze()) continue;
/*
* Comment goes here
*/
static inline int try_to_freeze(void)
{
/* I think the compiler propagates likeliness to the inline's caller */
if (unlikely(current->flags & PF_FREEZE)) {
refrigerator(PF_FREEZE);
return 1;
}
return 0;
}Hi.
Quoted 17 lines · Andrew Morton
drivers/ieee1394/nodemgr.c line 1502
Quoted 5 lines · Nigel Cunningham
drivers/ieee1394/nodemgr.c +4
-0+if (current->flags &PF_FREEZE ) { +refrigerator (PF_FREEZE ); +continue ; + }This seems excessively verbose. Why not do:
if (try_to_freeze()) continue;/*
* Comment goes here
*/
static inline inttry_to_freeze(void)
Quoted 8 lines
{
/* I think the compiler propagates likeliness to the inline's caller */
if (unlikely(current->flags & PF_FREEZE)) {
refrigerator(PF_FREEZE);
return 1;
}
return 0;
}Probably because I haven't seen that macro before. Looks good. I'll make use of it and add it to suspend2 too, so that whenever we get the merge done, it doesn't disappear.
Regards.
Nigel