Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\tsc.c Create Date:2022-07-28 07:46:10
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__set_cyc2ns_scale

Proto:static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)

Type:void

Parameter:

TypeParameterName
unsigned longkhz
intcpu
unsigned long longtsc_now
129  ns_now = Accelerators for sched_clock()* convert from cycles(64bits) => nanoseconds (64bits)* basic equation:* ns = cycles / (freq / ns_per_sec)* ns = cycles * (ns_per_sec / freq)* ns = cycles * (10^9 / (cpu_khz * 10^3))* ns = cycles * (10^6 / cpu_khz)
136  clocks_calc_mult_shift( & cyc2ns_mul, & cyc2ns_shift, khz, NSEC_PER_MSEC, 0)
145  If cyc2ns_shift == 32 Then
146  cyc2ns_shift = 31
147  cyc2ns_mul >>= 1
150  cyc2ns_offset = ns_now - mul_u64_u32_shr(tsc_now, cyc2ns_mul, cyc2ns_shift)
153  c2n = per_cpu_ptr( & cyc2ns, cpu)
155  aw_write_seqcount_latch - redirect readers to even/odd copy*@s: pointer to seqcount_t* The latch technique is a multiversion concurrency control method that allows* queries during non-atomic modifications. If you can guarantee queries never
156  0 + 2*16 = 32 [0] = data
157  aw_write_seqcount_latch - redirect readers to even/odd copy*@s: pointer to seqcount_t* The latch technique is a multiversion concurrency control method that allows* queries during non-atomic modifications. If you can guarantee queries never
158  0 + 2*16 = 32 [1] = data
Caller
NameDescribe
set_cyc2ns_scale
cyc2ns_init_boot_cpuInitialize cyc2ns for boot cpu