sched: rename __prepare_to_swait() to add_swait_queue_locked()
PATCH 1/1 sched: rename __prepare_to_swait() to add_swait_queue_locked()
This function just puts wait into queue, and does not do an operation similar to prepare_to_wait() in wait.c.
And during the operation, the caller needs to hold the lock to protect.
Signed-off-by Wang Qing <[email protected]>
--- kernel/sched/completion.c | 2 +- kernel/sched/sched.h | 2 +- kernel/sched/swait.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
kernel/sched/completion.c +1 -1
@@ -79,7 +79,7 @@ do_wait_for_common(struct completion *x, timeout = -ERESTARTSYS ;break ; } -__prepare_to_swait (&x->wait, &wait); +add_swait_queue_locked (&x->wait, &wait);__set_current_state (state);raw_spin_unlock_irq (&x->wait.lock); timeout =action (timeout);
kernel/sched/sched.h +1 -1
@@ -2719,4 +2719,4 @@ static inline bool is_per_cpu_kthread(struct task_struct *p)#endif void swake_up_all_locked (struct swait_queue_head *q); -void __prepare_to_swait (struct swait_queue_head *q,struct swait_queue *wait); +void add_swait_queue_locked (struct swait_queue_head *q,struct swait_queue *wait);
kernel/sched/swait.c +3 -3
@@ -82,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q) }EXPORT_SYMBOL (swake_up_all); -void __prepare_to_swait (struct swait_queue_head *q,struct swait_queue *wait) +void add_swait_queue_locked (struct swait_queue_head *q,struct swait_queue *wait) { wait->task = current;if (list_empty (&wait->task_list))
@@ -94,7 +94,7 @@ void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *unsigned long flags;raw_spin_lock_irqsave (&q->lock, flags); -__prepare_to_swait (q, wait); +add_swait_queue_locked (q, wait);set_current_state (state);raw_spin_unlock_irqrestore (&q->lock, flags); }
@@ -114,7 +114,7 @@ long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *waitlist_del_init (&wait->task_list); ret = -ERESTARTSYS ; }else { -__prepare_to_swait (q, wait); +add_swait_queue_locked (q, wait);set_current_state (state); }raw_spin_unlock_irqrestore (&q->lock, flags);
Signature · 1 line
2.7.4
Quoted 3 lines · Wang Qing
This function just puts wait into queue, and does not do an operation similar to
prepare_to_wait()inwait.c.
And during the operation, the caller needs to hold the lock to protect.
I see zero benefit to churn like this. You're taking a dinky little file that's perfectly clear (and pretty), and restating the obvious.
Quoted 62 lines
Signed-off-by Wang Qing <[email protected]>--- kernel/sched/completion.c | 2 +- kernel/sched/sched.h | 2 +- kernel/sched/swait.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)kernel/sched/completion.c +1
-1@@ -79,7 +79,7 @@ do_wait_for_common(struct completion *x, timeout = -ERESTARTSYS ;break ; } -__prepare_to_swait (&x->wait, &wait); +add_swait_queue_locked (&x->wait, &wait);__set_current_state (state);raw_spin_unlock_irq (&x->wait.lock); timeout =action (timeout);kernel/sched/sched.h +1
-1@@ -2719,4 +2719,4 @@ static inline bool is_per_cpu_kthread(struct task_struct *p)#endif void swake_up_all_locked (struct swait_queue_head *q); -void __prepare_to_swait (struct swait_queue_head *q,struct swait_queue *wait); +void add_swait_queue_locked (struct swait_queue_head *q,struct swait_queue *wait);kernel/sched/swait.c +3
-3@@ -82,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q) }EXPORT_SYMBOL (swake_up_all); -void __prepare_to_swait (struct swait_queue_head *q,struct swait_queue *wait) +void add_swait_queue_locked (struct swait_queue_head *q,struct swait_queue *wait) { wait->task = current;if (list_empty (&wait->task_list))@@ -94,7 +94,7 @@ void prepare_to_swait_exclusive(struct swait_queue_head *q, struct swait_queue *unsigned long flags;raw_spin_lock_irqsave (&q->lock, flags); -__prepare_to_swait (q, wait); +add_swait_queue_locked (q, wait);set_current_state (state);raw_spin_unlock_irqrestore (&q->lock, flags); }@@ -114,7 +114,7 @@ long prepare_to_swait_event(struct swait_queue_head *q, struct swait_queue *waitlist_del_init (&wait->task_list); ret = -ERESTARTSYS ; }else { -__prepare_to_swait (q, wait); +add_swait_queue_locked (q, wait);set_current_state (state); }raw_spin_unlock_irqrestore (&q->lock, flags);