Skip to contentSkip to conversation

Rename PF_IOTHREAD.

PATCH In review Nigel Cunningham 2 participants 2 messages Apr 19, 2004

Subsystems (22)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Rename PF_IOTHREAD.

Hi.

A few weeks ago, Pavel and I agreed that PF_IOTHREAD should be renamed to PF_NOFREEZE. This reflects the fact that some threads so marked aren't actually used for IO while suspending, but simply shouldn't be frozen. This patch, against 2.6.5 vanilla, applies that change. In the refrigerator calls, the actual value doesn't matter (so long as it's non-zero) and it makes more sense to use PF_FREEZE so I've used that.

Please apply.

Nigel

arch/i386/kernel/apm.c +1 -1
diff -ruN linux-2.6.5/arch/i386/kernel/apm.c linux-2.6.5-NoFreeze/arch/i386/kernel/apm.c
@@ -1701,7 +1701,7 @@
 
 	daemonize("kapmd");
 
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 #ifdef CONFIG_SMP
 	/* 2002/08/01 - WT
drivers/block/loop.c +1 -1
diff -ruN linux-2.6.5/drivers/block/loop.c linux-2.6.5-NoFreeze/drivers/block/loop.c
@@ -472,7 +472,7 @@
 	 * hence, it mustn't be stopped at all
 	 * because it could be indirectly used during suspension
 	 */
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	set_user_nice(current, -20);
 
drivers/input/serio/serio.c +1 -1
diff -ruN linux-2.6.5/drivers/input/serio/serio.c linux-2.6.5-NoFreeze/drivers/input/serio/serio.c
@@ -154,7 +154,7 @@
 		serio_handle_events();
 		wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); 
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 	} while (!signal_pending(current));
 
 	printk(KERN_DEBUG "serio: kseriod exiting\n");
drivers/md/md.c +1 -1
diff -ruN linux-2.6.5/drivers/md/md.c linux-2.6.5-NoFreeze/drivers/md/md.c
@@ -2711,7 +2711,7 @@
 		wait_event_interruptible(thread->wqueue,
 					 test_bit(THREAD_WAKEUP, &thread->flags));
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		clear_bit(THREAD_WAKEUP, &thread->flags);
 
drivers/net/8139too.c +1 -1
diff -ruN linux-2.6.5/drivers/net/8139too.c linux-2.6.5-NoFreeze/drivers/net/8139too.c
@@ -1619,7 +1619,7 @@
 			timeout = interruptible_sleep_on_timeout (&tp->thr_wait, timeout);
 			/* make swsusp happy with our thread */
 			if (current->flags & PF_FREEZE)
-				refrigerator(PF_IOTHREAD);
+				refrigerator(PF_FREEZE);
 		} while (!signal_pending (current) && (timeout > 0));
 
 		if (signal_pending (current)) {
drivers/net/irda/sir_kthread.c +1 -1
diff -ruN linux-2.6.5/drivers/net/irda/sir_kthread.c linux-2.6.5-NoFreeze/drivers/net/irda/sir_kthread.c
@@ -137,7 +137,7 @@
 
 		/* make swsusp happy with our thread */
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		run_irda_queue();
 	}
drivers/net/irda/stir4200.c +1 -1
diff -ruN linux-2.6.5/drivers/net/irda/stir4200.c linux-2.6.5-NoFreeze/drivers/net/irda/stir4200.c
@@ -774,7 +774,7 @@
 
 			write_reg(stir, REG_CTRL1, CTRL1_TXPWD|CTRL1_RXPWD);
 
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 			if (change_speed(stir, stir->speed))
 				break;
drivers/net/wireless/airo.c +1 -1
diff -ruN linux-2.6.5/drivers/net/wireless/airo.c linux-2.6.5-NoFreeze/drivers/net/wireless/airo.c
@@ -2883,7 +2883,7 @@
 
 		/* make swsusp happy with our thread */
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		if (test_bit(JOB_DIE, &ai->flags))
 			break;
drivers/pcmcia/cs.c +1 -1
diff -ruN linux-2.6.5/drivers/pcmcia/cs.c linux-2.6.5-NoFreeze/drivers/pcmcia/cs.c
@@ -720,7 +720,7 @@
 
 		schedule();
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		if (!skt->thread)
 			break;
drivers/scsi/libata-core.c +1 -1
diff -ruN linux-2.6.5/drivers/scsi/libata-core.c linux-2.6.5-NoFreeze/drivers/scsi/libata-core.c
@@ -2629,7 +2629,7 @@
                         flush_signals(current);
                         
                 if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
                                                         
 
                 if ((timeout < 0) || (ap->time_to_die))
drivers/scsi/scsi_error.c +1 -1
diff -ruN linux-2.6.5/drivers/scsi/scsi_error.c linux-2.6.5-NoFreeze/drivers/scsi/scsi_error.c
@@ -1620,7 +1620,7 @@
 
 	daemonize("scsi_eh_%d", shost->host_no);
 
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	shost->eh_wait = &sem;
 	shost->ehandler = current;
drivers/usb/core/hub.c +1 -1
diff -ruN linux-2.6.5/drivers/usb/core/hub.c linux-2.6.5-NoFreeze/drivers/usb/core/hub.c
@@ -1142,7 +1142,7 @@
 		hub_events();
 		wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); 
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 	} while (!signal_pending(current));
 
 	dbg("hub_thread exiting");
drivers/usb/storage/usb.c +1 -1
diff -ruN linux-2.6.5/drivers/usb/storage/usb.c linux-2.6.5-NoFreeze/drivers/usb/storage/usb.c
@@ -277,7 +277,7 @@
 	 */
 	daemonize("usb-storage");
 
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	unlock_kernel();
 
fs/jbd/journal.c +1 -1
diff -ruN linux-2.6.5/fs/jbd/journal.c linux-2.6.5-NoFreeze/fs/jbd/journal.c
@@ -172,7 +172,7 @@
 		 */
 		jbd_debug(1, "Now suspending kjournald\n");
 		spin_unlock(&journal->j_state_lock);
-		refrigerator(PF_IOTHREAD);
+		refrigerator(PF_FREEZE);
 		spin_lock(&journal->j_state_lock);
 	} else {
 		/*
fs/jfs/jfs_logmgr.c +1 -1
diff -ruN linux-2.6.5/fs/jfs/jfs_logmgr.c linux-2.6.5-NoFreeze/fs/jfs/jfs_logmgr.c
@@ -2330,7 +2330,7 @@
 		}
 		if (current->flags & PF_FREEZE) {
 			spin_unlock_irq(&log_redrive_lock);
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 		} else {
 			add_wait_queue(&jfs_IO_thread_wait, &wq);
 			set_current_state(TASK_INTERRUPTIBLE);
fs/jfs/jfs_txnmgr.c +2 -2
diff -ruN linux-2.6.5/fs/jfs/jfs_txnmgr.c linux-2.6.5-NoFreeze/fs/jfs/jfs_txnmgr.c
@@ -2813,7 +2813,7 @@
 
 		if (current->flags & PF_FREEZE) {
 			LAZY_UNLOCK(flags);
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 		} else {
 			DECLARE_WAITQUEUE(wq, current);
 
@@ -3017,7 +3017,7 @@
 
 		if (current->flags & PF_FREEZE) {
 			TXN_UNLOCK();
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 		} else {
 			DECLARE_WAITQUEUE(wq, current);
 
fs/xfs/linux/xfs_buf.c +1 -1
diff -ruN linux-2.6.5/fs/xfs/linux/xfs_buf.c linux-2.6.5-NoFreeze/fs/xfs/linux/xfs_buf.c
@@ -1633,7 +1633,7 @@
 	do {
 		/* swsusp */
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(xfs_flush_interval);
fs/xfs/linux/xfs_super.c +1 -1
diff -ruN linux-2.6.5/fs/xfs/linux/xfs_super.c linux-2.6.5-NoFreeze/fs/xfs/linux/xfs_super.c
@@ -464,7 +464,7 @@
 		schedule_timeout(xfs_syncd_interval);
 		/* swsusp */
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 		if (vfsp->vfs_flag & VFS_UMOUNT)
 			break;
 		if (vfsp->vfs_flag & VFS_RDONLY)
include/linux/sched.h +1 -1
diff -ruN linux-2.6.5/include/linux/sched.h linux-2.6.5-NoFreeze/include/linux/sched.h
@@ -522,7 +522,7 @@
 #define PF_FLUSHER	0x00002000	/* responsible for disk writeback */
 
 #define PF_FREEZE	0x00004000	/* this task should be frozen for suspend */
-#define PF_IOTHREAD	0x00008000	/* this thread is needed for doing I/O to swap */
+#define PF_NOFREEZE	0x00008000	/* this thread should not be frozen */
 #define PF_FROZEN	0x00010000	/* frozen for system suspend */
 #define PF_FSTRANS	0x00020000	/* inside a filesystem transaction */
 #define PF_KSWAPD	0x00040000	/* I am kswapd */
kernel/power/process.c +1 -1
diff -ruN linux-2.6.5/kernel/power/process.c linux-2.6.5-NoFreeze/kernel/power/process.c
@@ -28,7 +28,7 @@
 static inline int freezeable(struct task_struct * p)
 {
 	if ((p == current) || 
-	    (p->flags & PF_IOTHREAD) || 
+	    (p->flags & PF_NOFREEZE) || 
 	    (p->state == TASK_ZOMBIE) ||
 	    (p->state == TASK_DEAD))
 		return 0;
kernel/sched.c +1 -1
diff -ruN linux-2.6.5/kernel/sched.c linux-2.6.5-NoFreeze/kernel/sched.c
@@ -2778,7 +2778,7 @@
 		migration_req_t *req;
 
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		spin_lock_irq(&rq->lock);
 		head = &rq->migration_queue;
kernel/softirq.c +1 -1
diff -ruN linux-2.6.5/kernel/softirq.c linux-2.6.5-NoFreeze/kernel/softirq.c
@@ -309,7 +309,7 @@
 static int ksoftirqd(void * __bind_cpu)
 {
 	set_user_nice(current, 19);
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	set_current_state(TASK_INTERRUPTIBLE);
 
kernel/workqueue.c +1 -1
diff -ruN linux-2.6.5/kernel/workqueue.c linux-2.6.5-NoFreeze/kernel/workqueue.c
@@ -181,7 +181,7 @@
 	struct k_sigaction sa;
 	sigset_t blocked;
 
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	set_user_nice(current, -10);
 
mm/pdflush.c +1 -1
diff -ruN linux-2.6.5/mm/pdflush.c linux-2.6.5-NoFreeze/mm/pdflush.c
@@ -107,7 +107,7 @@
 
 		schedule();
 		if (current->flags & PF_FREEZE) {
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 			spin_lock_irq(&pdflush_lock);
 			continue;
 		}
mm/vmscan.c +1 -1
diff -ruN linux-2.6.5/mm/vmscan.c linux-2.6.5-NoFreeze/mm/vmscan.c
@@ -1052,7 +1052,7 @@
 		struct page_state ps;
 
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 		prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
 		schedule();
 		finish_wait(&pgdat->kswapd_wait, &wait);
net/bluetooth/bnep/core.c +1 -1
diff -ruN linux-2.6.5/net/bluetooth/bnep/core.c linux-2.6.5-NoFreeze/net/bluetooth/bnep/core.c
@@ -458,7 +458,7 @@
 
         daemonize("kbnepd %s", dev->name);
 	set_user_nice(current, -15);
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
         set_fs(KERNEL_DS);
 
net/bluetooth/cmtp/core.c +1 -1
diff -ruN linux-2.6.5/net/bluetooth/cmtp/core.c linux-2.6.5-NoFreeze/net/bluetooth/cmtp/core.c
@@ -293,7 +293,7 @@
 
 	daemonize("kcmtpd_ctr_%d", session->num);
 	set_user_nice(current, -15);
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	set_fs(KERNEL_DS);
 
net/bluetooth/rfcomm/core.c +1 -1
diff -ruN linux-2.6.5/net/bluetooth/rfcomm/core.c linux-2.6.5-NoFreeze/net/bluetooth/rfcomm/core.c
@@ -1819,7 +1819,7 @@
 
 	daemonize("krfcommd");
 	set_user_nice(current, -10);
-	current->flags |= PF_IOTHREAD;
+	current->flags |= PF_NOFREEZE;
 
 	set_fs(KERNEL_DS);
 
net/sunrpc/sched.c +1 -1
diff -ruN linux-2.6.5/net/sunrpc/sched.c linux-2.6.5-NoFreeze/net/sunrpc/sched.c
@@ -976,7 +976,7 @@
 		}
 		__rpc_schedule();
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		if (++rounds >= 64) {	/* safeguard */
 			schedule();
net/sunrpc/svcsock.c +1 -1
diff -ruN linux-2.6.5/net/sunrpc/svcsock.c linux-2.6.5-NoFreeze/net/sunrpc/svcsock.c
@@ -1209,7 +1209,7 @@
 		schedule_timeout(timeout);
 
 		if (current->flags & PF_FREEZE)
-			refrigerator(PF_IOTHREAD);
+			refrigerator(PF_FREEZE);
 
 		spin_lock_bh(&serv->sv_lock);
 		remove_wait_queue(&rqstp->rq_wait, &wait);
#1 lore raw

Hi!

Quoted 8 lines

A few weeks ago, Pavel and I agreed that PF_IOTHREAD should be renamed to PF_NOFREEZE. This reflects the fact that some threads so marked aren't actually used for IO while suspending, but simply shouldn't be frozen. This patch, against 2.6.5 vanilla, applies that change. In the refrigerator calls, the actual value doesn't matter (so long as it's non-zero) and it makes more sense to use PF_FREEZE so I've used that.

Please apply.

Patch looks good. [Except that I'm not sure if this hunk will apply; there were changes for ^Z in this area].
Pavel

Quoted 12 lines

diff -ruN linux-2.6.5/kernel/power/process.c linux-2.6.5-NoFreeze/kernel/power/process.c

kernel/power/process.c +1 -1
@@ -28,7 +28,7 @@
 static inline int freezeable(struct task_struct * p)
 {
 	if ((p == current) || 
-	    (p->flags & PF_IOTHREAD) || 
+	    (p->flags & PF_NOFREEZE) || 
 	    (p->state == TASK_ZOMBIE) ||
 	    (p->state == TASK_DEAD))
 		return 0;
Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]