Re: access to jiffies_64 atomic or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Robert P. J. Day,

Someone makes a test program like this:


jiffier.c

int main()
{
unsigned long jiffiers = 777;
jiffiers++;
return 0;
}

#gcc -S jiffer1.c  (compile it to assembly language)

.file "jiffier1.c"
.version "01.01"
gcc2_compiled.:
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp, %ebp
subl , %esp
movl 7, -4(%ebp)
leal -4(%ebp), %eax
incl (%eax)
movl , %eax
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.3 2.96-110)"


We can see that the value of jiffiers increment directly in the memory.


Sincerely yours,
chiachen
luojiazhen@xxxxxxxxx
2009-12-30

======= 2009-12-29 22:15, your message: access to jiffies_64 atomic or not?=======


from kernel/timer.c:

/*
* The 64-bit jiffies value is not atomic - you MUST NOT read it
* without sampling the sequence number in xtime_lock.
* jiffies is defined in the linker script...
*/

void do_timer(unsigned long ticks)
{
jiffies_64 += ticks;
update_wall_time();
calc_global_load();
}

i'm not sure how to interpret that comment since it clearly suggests
that you can't simply access jiffies_64, but that's exactly what
do_timer() is doing in that first line by incrementing it by a certain
value. can anyone clarify whether the above makes any sense?

rday
--

========================================================================
Robert P. J. Day Waterloo, Ontario, CANADA

Linux Consulting, Training and Kernel Pedantry.

Web page: http://crashcourse.ca
Twitter: http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ

.


= = = = = = = = = = = = = = = = = = = =


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux