Re: [patch 1/3] new timerfd API - new timerfd API

From: Davide Libenzi
Date: Mon Sep 24 2007 - 11:42:59 EST


On Mon, 24 Sep 2007, Thomas Gleixner wrote:

> > struct timerfd_ctx {
> > struct hrtimer tmr;
> > + int clockid;
> > ktime_t tintv;
> > wait_queue_head_t wqh;
> > int expired;
> > + u64 ticks;
> > };
>
> Can you please restructure the struct in a way which does not result in
> padding by the compiler ?
>
> struct timerfd_ctx {
> struct hrtimer tmr;
> ktime_t tintv;
> wait_queue_head_t wqh;
> u64 ticks;
> int expired;
> int clockid;
> };

Sure.



> > + ticks += (u64)
> > hrtimer_forward(&ctx->tmr,
> > hrtimer_cb_get_time(&ctx->tmr),
>
> You need to use ctx->tmr.base->get_time() here, otherwise you might read
> a stale time value (in case that CONFIG_HIGH_RES_TIMERS is off).

Is the particular position of hrtimer_cb_get_time() in the code that would
break here? Because function was added by your patch ;)
Did something change later?



> > +err_kfree_ctx:
> > + kfree(ctx);
> > + return error;
>
> You really can avoid the goto here.

Ack.



- Davide


-
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/