History

delayacct: Use sched_clock()

Like all scheduler statistics, use sched_clock() based time.

Peter Zijlstra committed 5 years ago

Commit 4b7a08a1 parent 619e0901 file · +10 −12Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/delayacct.c+10−12
@@ -7,9 +7,9 @@ · 6 unmodified lines
77 #include <linux/sched.h>
88 #include <linux/sched/task.h>
99 #include <linux/sched/cputime.h>
10+#include <linux/sched/clock.h>
1011 #include <linux/slab.h>
1112 #include <linux/taskstats.h>
12−#include <linux/time.h>
1313 #include <linux/sysctl.h>
1414 #include <linux/delayacct.h>
1515 #include <linux/module.h>
@@ -42,10 +42,9 @@ void __delayacct_tsk_init(struct task_struct *tsk) · 26 unmodified lines
4242 * Finish delay accounting for a statistic using its timestamps (@start),
4343 * accumalator (@total) and @count
4444 */
45−static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total,
46− u32 *count)
45+static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, u32 *count)
4746 {
48− s64 ns = ktime_get_ns() - *start;
47+ s64 ns = local_clock() - *start;
4948 unsigned long flags;
5049
5150 if (ns > 0) {
@@ -58,7 +57,7 @@ static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, · 6 unmodified lines
5857
5958 void __delayacct_blkio_start(void)
6059 {
61− current->delays->blkio_start = ktime_get_ns();
60+ current->delays->blkio_start = local_clock();
6261 }
6362
6463 /*
@@ -151,21 +150,20 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk) · 86 unmodified lines
151150
152151 void __delayacct_freepages_start(void)
153152 {
154− current->delays->freepages_start = ktime_get_ns();
153+ current->delays->freepages_start = local_clock();
155154 }
156155
157156 void __delayacct_freepages_end(void)
158157 {
159− delayacct_end(
160− &current->delays->lock,
161− &current->delays->freepages_start,
162− &current->delays->freepages_delay,
163− &current->delays->freepages_count);
158+ delayacct_end(&current->delays->lock,
159+ &current->delays->freepages_start,
160+ &current->delays->freepages_delay,
161+ &current->delays->freepages_count);
164162 }
165163
166164 void __delayacct_thrashing_start(void)
167165 {
168− current->delays->thrashing_start = ktime_get_ns();
166+ current->delays->thrashing_start = local_clock();
169167 }
170168
171169 void __delayacct_thrashing_end(void)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t