Skip to content

Commit

Permalink
Add alternate HZ calculation using write_expire
Browse files Browse the repository at this point in the history
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 <k-hagio-ab@nec.com>
  • Loading branch information
k-hagio committed Apr 26, 2021
1 parent f1f2cd5 commit b93027c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions task.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,29 @@ task_init(void)
"cfq_slice_async exists: setting hz to %d\n",
machdep->hz);
}
} else if ((symbol_exists("dd_init_queue") &&
gdb_set_crash_scope(symbol_value("dd_init_queue"), "dd_init_queue")) ||
(symbol_exists("deadline_init_queue") &&
gdb_set_crash_scope(symbol_value("deadline_init_queue"), "deadline_init_queue"))) {
char buf[BUFSIZE];
uint write_expire = 0;

open_tmpfile();
sprintf(buf, "printf \"%%d\", write_expire");
if (gdb_pass_through(buf, pc->tmpfile, GNU_RETURN_ON_ERROR)) {
rewind(pc->tmpfile);
if (fgets(buf, BUFSIZE, pc->tmpfile))
sscanf(buf, "%d", &write_expire);
}
close_tmpfile();

if (write_expire) {
machdep->hz = write_expire / 5;
if (CRASHDEBUG(2))
fprintf(fp, "write_expire exists: setting hz to %d\n",
machdep->hz);
}
gdb_set_crash_scope(0, NULL);
}

if (VALID_MEMBER(runqueue_arrays))
Expand Down

0 comments on commit b93027c

Please sign in to comment.