Debian Codegraph @

runtime/linux/autoconf-cpu-clock.c

raw
1 #include <linux/sched.h>
2
3 // On 4.13 kernels, linux/sched.h doesn't include
4 // linux/sched/clock.h, where cpu_clock() is declared.
5 #include <linux/blkdev.h>
6
7 //
8 // The following kernel commit inlined the cpu_clock()
9 //
10 // commit 2c923e94cd9c6acff3b22f0ae29cfe65e2658b40
11 // Author: Daniel Lezcano <[email protected]>
12 // Date: Mon Apr 11 16:38:34 2016 +0200
13 //
14 // sched/clock: Make local_clock()/cpu_clock() inline
15 //
16 // The local_clock/cpu_clock functions were changed to prevent a double
17 // identical test with sched_clock_cpu() when HAVE_UNSTABLE_SCHED_CLOCK
18 // is set. That resulted in one line functions.
19 //
20 // As these functions are in all the cases one line functions and in the
21 // hot path, it is useful to specify them as static inline in order to
22 // give a strong hint to the compiler.
23 //
24 // After verification, it appears the compiler does not inline them
25 // without this hint. Change those functions to static inline.
26 //
27 // sched_clock_cpu() is called via the inlined local_clock()/cpu_clock()
28 // functions from sched.h. So any module code including sched.h will
29 // reference sched_clock_cpu(). Thus it must be exported with the
30 // EXPORT_SYMBOL_GPL macro.
31 //
32 void foo (void);
33
34 void foo (void) {
35 (void) cpu_clock(0);
36 }