Skip to content

Commit b93027c

Browse files
committed
Add alternate HZ calculation using write_expire
Linux 4.8 and later kernels that contain kernel commit 9a7f38c42c2b ("cfq-iosched: Convert from jiffies to nanoseconds") changed the definition of cfq_slice_async, and it cannot be used to calculate the HZ value. Add alternate HZ calculation using write_expire, which depends on CONFIG_MQ_IOSCHED_DEADLINE or CONFIG_IOSCHED_DEADLINE. Signed-off-by: Kazuhito Hagio <[email protected]>
1 parent f1f2cd5 commit b93027c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

task.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,29 @@ task_init(void)
432432
"cfq_slice_async exists: setting hz to %d\n",
433433
machdep->hz);
434434
}
435+
} else if ((symbol_exists("dd_init_queue") &&
436+
gdb_set_crash_scope(symbol_value("dd_init_queue"), "dd_init_queue")) ||
437+
(symbol_exists("deadline_init_queue") &&
438+
gdb_set_crash_scope(symbol_value("deadline_init_queue"), "deadline_init_queue"))) {
439+
char buf[BUFSIZE];
440+
uint write_expire = 0;
441+
442+
open_tmpfile();
443+
sprintf(buf, "printf \"%%d\", write_expire");
444+
if (gdb_pass_through(buf, pc->tmpfile, GNU_RETURN_ON_ERROR)) {
445+
rewind(pc->tmpfile);
446+
if (fgets(buf, BUFSIZE, pc->tmpfile))
447+
sscanf(buf, "%d", &write_expire);
448+
}
449+
close_tmpfile();
450+
451+
if (write_expire) {
452+
machdep->hz = write_expire / 5;
453+
if (CRASHDEBUG(2))
454+
fprintf(fp, "write_expire exists: setting hz to %d\n",
455+
machdep->hz);
456+
}
457+
gdb_set_crash_scope(0, NULL);
435458
}
436459

437460
if (VALID_MEMBER(runqueue_arrays))

0 commit comments

Comments
 (0)