Skip to content

Commit f1f2cd5

Browse files
Moore, Martin (Linux ERT)k-hagio
authored andcommitted
Skip HZ calculation using cfq_slice_async in Linux 4.8+
In task_init() there is a calculation of machdep->hz based on the value of cfq_slice_async if the symbol exists. However, kernel commit 9a7f38c42c2b ("cfq-iosched: Convert from jiffies to nanoseconds") changed the definition of cfq_slice_async from (HZ / 25) to (NSEC_PER_SEC / 25). As such, the HZ calculation will result in a value of 1000000000 for machdep->hz. In vmcores where the symbol exists and has this definition, this causes incorrect results for some calculations. For a couple of 4.12 vmcores in this situation crash shows the uptime as 3 seconds, which also throws off the timestamps in "log -T". Fix this by skipping the code block for Linux 4.8 and above. Signed-off-by: Martin Moore <[email protected]>
1 parent 5664c58 commit f1f2cd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

task.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ task_init(void)
417417

418418
STRUCT_SIZE_INIT(cputime_t, "cputime_t");
419419

420-
if (symbol_exists("cfq_slice_async")) {
420+
if ((THIS_KERNEL_VERSION < LINUX(4,8,0)) &&
421+
symbol_exists("cfq_slice_async")) {
421422
uint cfq_slice_async;
422423

423424
get_symbol_data("cfq_slice_async", sizeof(int),

0 commit comments

Comments
 (0)