Commit 0fec171c authored by Ingo Molnar's avatar Ingo Molnar

sched: clean up sleep_on() APIs

clean up the sleep_on() APIs:

 - do not use fastcall
 - replace fragile macro magic with proper inline functions
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9761eea8
...@@ -366,15 +366,15 @@ static inline void remove_wait_queue_locked(wait_queue_head_t *q, ...@@ -366,15 +366,15 @@ static inline void remove_wait_queue_locked(wait_queue_head_t *q,
/* /*
* These are the old interfaces to sleep waiting for an event. * These are the old interfaces to sleep waiting for an event.
* They are racy. DO NOT use them, use the wait_event* interfaces above. * They are racy. DO NOT use them, use the wait_event* interfaces above.
* We plan to remove these interfaces during 2.7. * We plan to remove these interfaces.
*/ */
extern void FASTCALL(sleep_on(wait_queue_head_t *q)); extern void sleep_on(wait_queue_head_t *q);
extern long FASTCALL(sleep_on_timeout(wait_queue_head_t *q, extern long sleep_on_timeout(wait_queue_head_t *q,
signed long timeout)); signed long timeout);
extern void FASTCALL(interruptible_sleep_on(wait_queue_head_t *q)); extern void interruptible_sleep_on(wait_queue_head_t *q);
extern long FASTCALL(interruptible_sleep_on_timeout(wait_queue_head_t *q, extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,
signed long timeout)); signed long timeout);
/* /*
* Waitqueues which are removed from the waitqueue_head at wakeup time * Waitqueues which are removed from the waitqueue_head at wakeup time
......
...@@ -3699,74 +3699,85 @@ wait_for_completion_interruptible_timeout(struct completion *x, ...@@ -3699,74 +3699,85 @@ wait_for_completion_interruptible_timeout(struct completion *x,
} }
EXPORT_SYMBOL(wait_for_completion_interruptible_timeout); EXPORT_SYMBOL(wait_for_completion_interruptible_timeout);
static inline void
#define SLEEP_ON_VAR \ sleep_on_head(wait_queue_head_t *q, wait_queue_t *wait, unsigned long *flags)
unsigned long flags; \ {
wait_queue_t wait; \ spin_lock_irqsave(&q->lock, *flags);
init_waitqueue_entry(&wait, current); __add_wait_queue(q, wait);
#define SLEEP_ON_HEAD \
spin_lock_irqsave(&q->lock,flags); \
__add_wait_queue(q, &wait); \
spin_unlock(&q->lock); spin_unlock(&q->lock);
}
#define SLEEP_ON_TAIL \ static inline void
spin_lock_irq(&q->lock); \ sleep_on_tail(wait_queue_head_t *q, wait_queue_t *wait, unsigned long *flags)
__remove_wait_queue(q, &wait); \ {
spin_unlock_irqrestore(&q->lock, flags); spin_lock_irq(&q->lock);
__remove_wait_queue(q, wait);
spin_unlock_irqrestore(&q->lock, *flags);
}
void fastcall __sched interruptible_sleep_on(wait_queue_head_t *q) void __sched interruptible_sleep_on(wait_queue_head_t *q)
{ {
SLEEP_ON_VAR unsigned long flags;
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
SLEEP_ON_HEAD sleep_on_head(q, &wait, &flags);
schedule(); schedule();
SLEEP_ON_TAIL sleep_on_tail(q, &wait, &flags);
} }
EXPORT_SYMBOL(interruptible_sleep_on); EXPORT_SYMBOL(interruptible_sleep_on);
long fastcall __sched long __sched
interruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout) interruptible_sleep_on_timeout(wait_queue_head_t *q, long timeout)
{ {
SLEEP_ON_VAR unsigned long flags;
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
SLEEP_ON_HEAD sleep_on_head(q, &wait, &flags);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
SLEEP_ON_TAIL sleep_on_tail(q, &wait, &flags);
return timeout; return timeout;
} }
EXPORT_SYMBOL(interruptible_sleep_on_timeout); EXPORT_SYMBOL(interruptible_sleep_on_timeout);
void fastcall __sched sleep_on(wait_queue_head_t *q) void __sched sleep_on(wait_queue_head_t *q)
{ {
SLEEP_ON_VAR unsigned long flags;
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
SLEEP_ON_HEAD sleep_on_head(q, &wait, &flags);
schedule(); schedule();
SLEEP_ON_TAIL sleep_on_tail(q, &wait, &flags);
} }
EXPORT_SYMBOL(sleep_on); EXPORT_SYMBOL(sleep_on);
long fastcall __sched sleep_on_timeout(wait_queue_head_t *q, long timeout) long __sched sleep_on_timeout(wait_queue_head_t *q, long timeout)
{ {
SLEEP_ON_VAR unsigned long flags;
wait_queue_t wait;
init_waitqueue_entry(&wait, current);
current->state = TASK_UNINTERRUPTIBLE; current->state = TASK_UNINTERRUPTIBLE;
SLEEP_ON_HEAD sleep_on_head(q, &wait, &flags);
timeout = schedule_timeout(timeout); timeout = schedule_timeout(timeout);
SLEEP_ON_TAIL sleep_on_tail(q, &wait, &flags);
return timeout; return timeout;
} }
EXPORT_SYMBOL(sleep_on_timeout); EXPORT_SYMBOL(sleep_on_timeout);
#ifdef CONFIG_RT_MUTEXES #ifdef CONFIG_RT_MUTEXES
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment