Re: [RFC 2/7] hrtimer: don't check for active hrtimer after adding it

From: Viresh Kumar
Date: Wed Jul 09 2014 - 11:25:17 EST


On 9 July 2014 16:04, Chris Redpath <Chris.Redpath@xxxxxxx> wrote:
> On 09/07/14 07:55, Viresh Kumar wrote:
>> diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
>> index cf40209..a76f962 100644
>> --- a/kernel/hrtimer.c
>> +++ b/kernel/hrtimer.c
>> @@ -1555,8 +1555,6 @@ static int __sched do_nanosleep(struct
>> hrtimer_sleeper *t, enum hrtimer_mode mod
>> do {
>> set_current_state(TASK_INTERRUPTIBLE);
>> hrtimer_start_expires(&t->timer, mode);
>> - if (!hrtimer_active(&t->timer))
>> - t->task = NULL;
>>
>> if (likely(t->task))
>> freezable_schedule();
>> @@ -1837,8 +1835,6 @@ schedule_hrtimeout_range_clock(ktime_t *expires,
>> unsigned long delta,
>> hrtimer_init_sleeper(&t, current);
>>
>> hrtimer_start_expires(&t.timer, mode);
>> - if (!hrtimer_active(&t.timer))
>> - t.task = NULL;
>>
>> if (likely(t.task))
>> schedule();
>>
>
> Maybe safe to remove this if condition too.


Included following diff to this patch:

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index a76f962..ae7b5cf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1556,8 +1556,7 @@ static int __sched do_nanosleep(struct
hrtimer_sleeper *t, enum hrtimer_mode mod
set_current_state(TASK_INTERRUPTIBLE);
hrtimer_start_expires(&t->timer, mode);

- if (likely(t->task))
- freezable_schedule();
+ freezable_schedule();

hrtimer_cancel(&t->timer);
mode = HRTIMER_MODE_ABS;
@@ -1836,8 +1835,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires,
unsigned long delta,

hrtimer_start_expires(&t.timer, mode);

- if (likely(t.task))
- schedule();
+ schedule();

hrtimer_cancel(&t.timer);
destroy_hrtimer_on_stack(&t.timer);



Latest changes are pushed to my branch in case someone is looking to
test them.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/