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
7#include <linux/sched.h>7#include <linux/sched.h>
8#include <linux/sched/task.h>8#include <linux/sched/task.h>
9#include <linux/sched/cputime.h>9#include <linux/sched/cputime.h>
10#include <linux/sched/clock.h>
10#include <linux/slab.h>11#include <linux/slab.h>
11#include <linux/taskstats.h>12#include <linux/taskstats.h>
12#include <linux/time.h>
13#include <linux/sysctl.h>13#include <linux/sysctl.h>
14#include <linux/delayacct.h>14#include <linux/delayacct.h>
15#include <linux/module.h>15#include <linux/module.h>
@@ -42,10 +42,9 @@ void __delayacct_tsk_init(struct task_struct *tsk) · 26 unmodified lines
42 * Finish delay accounting for a statistic using its timestamps (@start),42 * Finish delay accounting for a statistic using its timestamps (@start),
43 * accumalator (@total) and @count43 * accumalator (@total) and @count
44 */44 */
45static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total,45static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, u32 *count)
46 u32 *count)
47{46{
48 s64 ns = ktime_get_ns() - *start;47 s64 ns = local_clock() - *start;
49 unsigned long flags;48 unsigned long flags;
50 49
51 if (ns > 0) {50 if (ns > 0) {
@@ -58,7 +57,7 @@ static void delayacct_end(raw_spinlock_t *lock, u64 *start, u64 *total, · 6 unmodified lines
58 57
59void __delayacct_blkio_start(void)58void __delayacct_blkio_start(void)
60{59{
61 current->delays->blkio_start = ktime_get_ns();60 current->delays->blkio_start = local_clock();
62}61}
63 62
64/*63/*
@@ -151,21 +150,20 @@ __u64 __delayacct_blkio_ticks(struct task_struct *tsk) · 86 unmodified lines
151 150
152void __delayacct_freepages_start(void)151void __delayacct_freepages_start(void)
153{152{
154 current->delays->freepages_start = ktime_get_ns();153 current->delays->freepages_start = local_clock();
155}154}
156 155
157void __delayacct_freepages_end(void)156void __delayacct_freepages_end(void)
158{157{
159 delayacct_end(158 delayacct_end(&current->delays->lock,
160 &current->delays->lock,159 &current->delays->freepages_start,
161 &current->delays->freepages_start,160 &current->delays->freepages_delay,
162 &current->delays->freepages_delay,161 &current->delays->freepages_count);
163 &current->delays->freepages_count);
164}162}
165 163
166void __delayacct_thrashing_start(void)164void __delayacct_thrashing_start(void)
167{165{
168 current->delays->thrashing_start = ktime_get_ns();166 current->delays->thrashing_start = local_clock();
169}167}
170 168
171void __delayacct_thrashing_end(void)169void __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