Messages in this thread | | | From | (Davide Libenzi) | Subject | Re: (*(unsigned long *)&jiffies)++; | Date | Thu, 6 Jan 2000 17:26:54 +0100 |
| |
On Thu, 06 Jan 2000, Richard B. Johnson wrote: > On Thu, 6 Jan 2000, Tigran Aivazian wrote: > > > Hi, > > > > Why does do_timer() do: > > > > (*(unsigned long *)&jiffies)++; > > > > why not just jiffies++; ? It works fine with jiffies++ but I assume there > > is a reason... > > > > Thanks, > > Tigran. > > > > It looks to me like there was an attempt to prevent the 'C' compiler > from doing: > > movl jiffies, %eax ! Read > incl %eax ! Modify > movl %eax, jiffies ! Write back > > ....and such attempts are rarely sucessful. > > Ideally, you'd want: > incl jiffies > > ...and you'd have to do it in assembly to make sure the next 'C' compiler > ddoesn't out-guess you. >
AFAIK the generated code is the same on intel. Having a single instruction to increment a memory location ( in any architecture ? ) why the compiler should split the operation ?
Cheers, Davide.
-- "Debian, the freedom in freedom."
- 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/
| |