Linux-kernel mailing list archive 2000-01,: Re: (*(unsigned long *)&jiffies)++;

# Re: (*(unsigned long *)&jiffies)++;

Tigran Aivazian (tigran@sco.COM)
Thu, 6 Jan 2000 15:26:45 +0000 (GMT)

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Davide Libenzi: "Re: (*(unsigned long *)&jiffies)++;"
- Previous message: Petko Manolov: "Re: (*(unsigned long *)&jiffies)++;"

oops. Forgot that there (may be) non-Intel archs out there....

On Thu, 6 Jan 2000, Tigran Aivazian wrote:

> On Thu, 6 Jan 2000, Petko Manolov wrote:
> > GCC optimize(reorder) "jiffies++" and "(*(unsigned long *)&jiffies)++"
> > is
> > used to be sure jiffies is incremented exactly where/when you want.
>
> Ok, then it applies to lost_ticks and lost_ticks_system as well. And
> therefore a cleaner way of doing it (as Richard Johnson suggested) would
> be in asm:
>
> --- timer.c.0 Thu Jan 6 15:13:21 2000
> +++ timer.c Thu Jan 6 15:15:31 2000
> @@ -629,12 +629,11 @@
>
> void do_timer(struct pt_regs * regs)
> {
> - /* (*(unsigned long *)&jiffies)++; */
> - jiffies++;
> - lost_ticks++;
> + __asm__ __volatile__("incl jiffies");
> + __asm__ __volatile__("incl lost_ticks");
> mark_bh(TIMER_BH);
> if (!user_mode(regs))
> - lost_ticks_system++;
> + __asm__ __volatile__("incl lost_ticks_system");
> if (tq_timer)
> mark_bh(TQUEUE_BH);
> }
>
> Thsi is better than the *& hack because it is gcc-version-independent.
>
> Regards,
> ------
> Tigran A. Aivazian | http://www.sco.com
> Escalations Research Group | tel: +44-(0)1923-813796
> Santa Cruz Operation Ltd | http://www.ocston.org/~tigran
>
>
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

- Next message: Davide Libenzi: "Re: (*(unsigned long *)&jiffies)++;"
- Previous message: Petko Manolov: "Re: (*(unsigned long *)&jiffies)++;"