Jiffies变量 。Jiffies变量用来记录系统自启动以来系统产生的 tick数,每次时钟中断+1。其定义方式如下: jiffies64在kernel/timer.c中定义: u64 jiffies_64cacheline_aligned_in_smp INITIAL_JIFFIES; EXPORT SYMBOL(jiffies_64); 在include/1inux/jiffies.h中 #define_jiffy_data_attribute_((section(".data"))) extern u64jiffy_data jiffies 64; extern unsigned long volatile_jiffy_data jiffies; Have the 32 bit jiffies value wrap 5 minutes after boot so jiffies wrap bugs show up earlier. #define INITIAL JIFFIES ((unsigned 1ong)(unsigned int)(-300*HZ)) 特香兰(xlanchen哪ustc,edu,cn)(计算Linux捧作系统分折Chapter7 Linux的时 January 14.2015 16/43
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jiffies变量 Jiffies变量用来记录系统自启动以来系统产生的 tick数,每次时钟中断+1。其定义方式如下: . jiffies_64在kernel/timer.c中定义: . . u64 jiffies_64 __cacheline_aligned_in_smp = INITIAL_JIFFIES; EXPORT_SYMBOL(jiffies_64); . 在include/linux/jiffies.h中 . . ... #define __jiffy_data __attribute__((section(”.data”))) ... extern u64 __jiffy_data jiffies_64; extern unsigned long volatile __jiffy_data jiffies; ... /* * Have the 32 bit jiffies value wrap 5 minutes after boot * so jiffies wrap bugs show up earlier. */ #define INITIAL_JIFFIES ((unsigned long)(unsigned int) (-300*HZ)) 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室 Linux操作系统分析Chapter 7 Linux的时钟和定时测量 @计算机学院嵌入式系统实验室@苏州研究院中国科学技术大学Fall 2014) January 14, 2015 16 / 43
Jiffies变量 ●jiffies_64和32位的jiffies的关系: jiffies在arch/arm/kernel,/vmlinux.1ds.S中定义 OUTPUT ARCH(arm) ENTRY(stext) #ifndef ARMEB jiffies jiffies 64; #else jiffies jiffies_64 +4; #endif 在vmlinux的符号表中,可以看到这两个变量 在同一个地址上 c0314554 D jiffies c0314554 D jiffies_64 至000 林香兰(xlanchene哪ustc,edu,cn)(计算inux捧作系统分折Chapter7 Linux的时 January 14.2015 16/43
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jiffies变量 jiffies_64和32位的jiffies的关系: . jiffies在arch/arm/kernel/vmlinux.lds.S中定义 . . ... OUTPUT_ARCH(arm) ENTRY(stext) #ifndef __ARMEB__ jiffies = jiffies_64; #else jiffies = jiffies_64 + 4; #endif ... . 在vmlinux的符号表中,可以看到这两个变量 在同一个地址上 . . c0314554 D jiffies c0314554 D jiffies_64 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室 Linux操作系统分析Chapter 7 Linux的时钟和定时测量 @计算机学院嵌入式系统实验室@苏州研究院中国科学技术大学Fall 2014) January 14, 2015 16 / 43
Jiffies变量 。jiffies变量的更新函数 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_times(ticks); 口·0421万至QC 练香兰(xlanchen哪ustc,edu.cn)(计算inux操作系航分折Chapter7 Linux的时4 January14.201516/49
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Jiffies变量 jiffies变量的更新函数 . 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_times(ticks); } 陈香兰(xlanchen@ustc.edu.cn) (计算机应用教研室 Linux操作系统分析Chapter 7 Linux的时钟和定时测量 @计算机学院嵌入式系统实验室@苏州研究院中国科学技术大学Fall 2014) January 14, 2015 16 / 43