Use __set_current_state() instead of current->state = (take 3)
Subsystems (3)
PATCH 1/1 Use __set_current_state() instead of current->state = (take 3)
Hi all
In fs/*.c, many functions manually set the task state directly accessing current->state, or with a macro, kind of inconsistently. This patch changes all of them to use [__]set_current_state().
Changelog:
Take 3:
- Port to 2.5.64
- Port to 2.5.57
- Use safe set_current_state() instead of __set... in
exec.c:de_thread()
Take 2:
- Added feedback from Robert Love regarding usage of __set_current_thread() vs. set_current_thread() to avoid race conditions related to memory flush.
- Use cond_resched() in namei.c:do_follow_link().
Take 1:
- Ported forward to 2.5.52
fs/exec.c renamed from fs/exec.c:1.1.1.15 +1 -1
@@ -633,7 +633,7 @@ count =1 ;while (atomic_read (&oldsig->count) > count) { oldsig->group_exit_task = current; - current->state =TASK_UNINTERRUPTIBLE ; +set_current_state (TASK_UNINTERRUPTIBLE );spin_unlock_irq (lock);schedule ();spin_lock_irq (lock);
fs/inode.c renamed from fs/inode.c:1.1.1.10 +1 -1
@@ -1208,7 +1208,7 @@ goto repeat; }remove_wait_queue (wq, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }void wake_up_inode (struct inode *inode)
fs/locks.c renamed from fs/locks.c:1.1.1.7 +2 -2
@@ -571,7 +571,7 @@int result =0 ;DECLARE_WAITQUEUE (wait, current); - current->state =TASK_INTERRUPTIBLE ; +set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (fl_wait, &wait);if (timeout ==0 )schedule ();
@@ -580,7 +580,7 @@if (signal_pending (current)) result = -ERESTARTSYS ;remove_wait_queue (fl_wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return result; }
fs/namei.c renamed from fs/namei.c:1.1.1.9 +1 -4
@@ -388,10 +388,7 @@ goto loop;if (current->total_link_count >=40 ) goto loop; -if (need_resched ()) { - current->state =TASK_RUNNING ; -schedule (); - } +cond_resched (); err =security_inode_follow_link (dentry, nd);if (err) goto loop;
fs/select.c renamed from fs/select.c:1.1.1.5 +2 -2
@@ -235,7 +235,7 @@ } __timeout =schedule_timeout (__timeout); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );poll_freewait (&table);
@@ -425,7 +425,7 @@break ; timeout =schedule_timeout (timeout); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return count; }
Signature · 1 line
Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my fault]