Skip to content

Commit

Permalink
hrtimer: Remove task argument from hrtimer_init_sleeper()
Browse files Browse the repository at this point in the history
All callers hand in 'current' and that's the only task pointer which
actually makes sense. Remove the task argument and set current in the
function.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20190726185752.791885290@linutronix.de
  • Loading branch information
Thomas Gleixner committed Jul 30, 2019
1 parent 511885d commit b744948
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -3418,7 +3418,7 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q,
hrtimer_init_on_stack(&hs.timer, CLOCK_MONOTONIC, mode);
hrtimer_set_expires(&hs.timer, kt);

hrtimer_init_sleeper(&hs, current);
hrtimer_init_sleeper(&hs);
do {
if (blk_mq_rq_state(rq) == MQ_RQ_COMPLETE)
break;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/android/vsoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ static int handle_vsoc_cond_wait(struct file *filp, struct vsoc_cond_wait *arg)
hrtimer_set_expires_range_ns(&to->timer, wake_time,
current->timer_slack_ns);

hrtimer_init_sleeper(to, current);
hrtimer_init_sleeper(to);
}

while (1) {
Expand Down
3 changes: 1 addition & 2 deletions include/linux/hrtimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ extern long hrtimer_nanosleep(const struct timespec64 *rqtp,
const enum hrtimer_mode mode,
const clockid_t clockid);

extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl,
struct task_struct *tsk);
extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl);

extern int schedule_hrtimeout_range(ktime_t *expires, u64 delta,
const enum hrtimer_mode mode);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ do { \
struct hrtimer_sleeper __t; \
\
hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); \
hrtimer_init_sleeper(&__t, current); \
hrtimer_init_sleeper(&__t); \
if ((timeout) != KTIME_MAX) \
hrtimer_start_range_ns(&__t.timer, timeout, \
current->timer_slack_ns, \
Expand Down
2 changes: 1 addition & 1 deletion kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ futex_setup_timer(ktime_t *time, struct hrtimer_sleeper *timeout,
hrtimer_init_on_stack(&timeout->timer, (flags & FLAGS_CLOCKRT) ?
CLOCK_REALTIME : CLOCK_MONOTONIC,
HRTIMER_MODE_ABS);
hrtimer_init_sleeper(timeout, current);
hrtimer_init_sleeper(timeout);

/*
* If range_ns is 0, calling hrtimer_set_expires_range_ns() is
Expand Down
8 changes: 4 additions & 4 deletions kernel/time/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,10 +1639,10 @@ static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer)
return HRTIMER_NORESTART;
}

void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
void hrtimer_init_sleeper(struct hrtimer_sleeper *sl)
{
sl->timer.function = hrtimer_wakeup;
sl->task = task;
sl->task = current;
}
EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);

Expand All @@ -1669,7 +1669,7 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
{
struct restart_block *restart;

hrtimer_init_sleeper(t, current);
hrtimer_init_sleeper(t);

do {
set_current_state(TASK_INTERRUPTIBLE);
Expand Down Expand Up @@ -1930,7 +1930,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
hrtimer_init_on_stack(&t.timer, clock_id, mode);
hrtimer_set_expires_range_ns(&t.timer, *expires, delta);

hrtimer_init_sleeper(&t, current);
hrtimer_init_sleeper(&t);

hrtimer_start_expires(&t.timer, mode);

Expand Down
2 changes: 1 addition & 1 deletion net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ static void spin(struct pktgen_dev *pkt_dev, ktime_t spin_until)
} while (ktime_compare(end_time, spin_until) < 0);
} else {
/* see do_nanosleep */
hrtimer_init_sleeper(&t, current);
hrtimer_init_sleeper(&t);
do {
set_current_state(TASK_INTERRUPTIBLE);
hrtimer_start_expires(&t.timer, HRTIMER_MODE_ABS);
Expand Down

0 comments on commit b744948

Please sign in to comment.