History

sched/headers: sched/clock: Mark all functions 'notrace', remove CC_FLAGS_FTRACE build asymmetry

Mark all non-init functions in kernel/sched.c as 'notrace', instead of turning them all off via CC_FLAGS_FTRACE. This is going to allow the treatment of this file as any other scheduler file, and it can be #include-ed in compound compilation units as well.

Ingo Molnar committed 5 years ago

Commit fa28abe1 parent d90a2f12 files · +21 −24Browse files

Unified · Split

2 files
  1. kernel/sched/Makefile +0 −3
  2. kernel/sched/clock.c +21 −21
kernel/sched/Makefile+0−3
@@ -1,7 +1,4 @@
1# SPDX-License-Identifier: GPL-2.01# SPDX-License-Identifier: GPL-2.0
2ifdef CONFIG_FUNCTION_TRACER
3CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE)
4endif
5 2
6# The compilers are complaining about unused variables inside an if(0) scope3# The compilers are complaining about unused variables inside an if(0) scope
7# block. This is daft, shut them up.4# block. This is daft, shut them up.
kernel/sched/clock.c+21−21
@@ -61,7 +61,7 @@ · 60 unmodified lines
61 * This is default implementation.61 * This is default implementation.
62 * Architectures and sub-architectures can override this.62 * Architectures and sub-architectures can override this.
63 */63 */
64unsigned long long __weak sched_clock(void)64notrace unsigned long long __weak sched_clock(void)
65{65{
66 return (unsigned long long)(jiffies - INITIAL_JIFFIES)66 return (unsigned long long)(jiffies - INITIAL_JIFFIES)
67 * (NSEC_PER_SEC / HZ);67 * (NSEC_PER_SEC / HZ);
@@ -95,28 +95,28 @@ struct sched_clock_data { · 27 unmodified lines
95 95
96static DEFINE_PER_CPU_SHARED_ALIGNED(struct sched_clock_data, sched_clock_data);96static DEFINE_PER_CPU_SHARED_ALIGNED(struct sched_clock_data, sched_clock_data);
97 97
98static inline struct sched_clock_data *this_scd(void)98notrace static inline struct sched_clock_data *this_scd(void)
99{99{
100 return this_cpu_ptr(&sched_clock_data);100 return this_cpu_ptr(&sched_clock_data);
101}101}
102 102
103static inline struct sched_clock_data *cpu_sdc(int cpu)103notrace static inline struct sched_clock_data *cpu_sdc(int cpu)
104{104{
105 return &per_cpu(sched_clock_data, cpu);105 return &per_cpu(sched_clock_data, cpu);
106}106}
107 107
108int sched_clock_stable(void)108notrace int sched_clock_stable(void)
109{109{
110 return static_branch_likely(&__sched_clock_stable);110 return static_branch_likely(&__sched_clock_stable);
111}111}
112 112
113static void __scd_stamp(struct sched_clock_data *scd)113notrace static void __scd_stamp(struct sched_clock_data *scd)
114{114{
115 scd->tick_gtod = ktime_get_ns();115 scd->tick_gtod = ktime_get_ns();
116 scd->tick_raw = sched_clock();116 scd->tick_raw = sched_clock();
117}117}
118 118
119static void __set_sched_clock_stable(void)119notrace static void __set_sched_clock_stable(void)
120{120{
121 struct sched_clock_data *scd;121 struct sched_clock_data *scd;
122 122
@@ -151,7 +151,7 @@ static void __set_sched_clock_stable(void) · 28 unmodified lines
151 * The only way to fully avoid random clock jumps is to boot with:151 * The only way to fully avoid random clock jumps is to boot with:
152 * "tsc=unstable".152 * "tsc=unstable".
153 */153 */
154static void __sched_clock_work(struct work_struct *work)154notrace static void __sched_clock_work(struct work_struct *work)
155{155{
156 struct sched_clock_data *scd;156 struct sched_clock_data *scd;
157 int cpu;157 int cpu;
@@ -177,7 +177,7 @@ static void __sched_clock_work(struct work_struct *work) · 19 unmodified lines
177 177
178static DECLARE_WORK(sched_clock_work, __sched_clock_work);178static DECLARE_WORK(sched_clock_work, __sched_clock_work);
179 179
180static void __clear_sched_clock_stable(void)180notrace static void __clear_sched_clock_stable(void)
181{181{
182 if (!sched_clock_stable())182 if (!sched_clock_stable())
183 return;183 return;
@@ -186,7 +186,7 @@ static void __clear_sched_clock_stable(void) · 2 unmodified lines
186 schedule_work(&sched_clock_work);186 schedule_work(&sched_clock_work);
187}187}
188 188
189void clear_sched_clock_stable(void)189notrace void clear_sched_clock_stable(void)
190{190{
191 __sched_clock_stable_early = 0;191 __sched_clock_stable_early = 0;
192 192
@@ -196,7 +196,7 @@ void clear_sched_clock_stable(void) · 3 unmodified lines
196 __clear_sched_clock_stable();196 __clear_sched_clock_stable();
197}197}
198 198
199static void __sched_clock_gtod_offset(void)199notrace static void __sched_clock_gtod_offset(void)
200{200{
201 struct sched_clock_data *scd = this_scd();201 struct sched_clock_data *scd = this_scd();
202 202
@@ -246,12 +246,12 @@ late_initcall(sched_clock_init_late); · 43 unmodified lines
246 * min, max except they take wrapping into account246 * min, max except they take wrapping into account
247 */247 */
248 248
249static inline u64 wrap_min(u64 x, u64 y)249notrace static inline u64 wrap_min(u64 x, u64 y)
250{250{
251 return (s64)(x - y) < 0 ? x : y;251 return (s64)(x - y) < 0 ? x : y;
252}252}
253 253
254static inline u64 wrap_max(u64 x, u64 y)254notrace static inline u64 wrap_max(u64 x, u64 y)
255{255{
256 return (s64)(x - y) > 0 ? x : y;256 return (s64)(x - y) > 0 ? x : y;
257}257}
@@ -262,7 +262,7 @@ static inline u64 wrap_max(u64 x, u64 y) · 4 unmodified lines
262 * - filter out backward motion262 * - filter out backward motion
263 * - use the GTOD tick value to create a window to filter crazy TSC values263 * - use the GTOD tick value to create a window to filter crazy TSC values
264 */264 */
265static u64 sched_clock_local(struct sched_clock_data *scd)265notrace static u64 sched_clock_local(struct sched_clock_data *scd)
266{266{
267 u64 now, clock, old_clock, min_clock, max_clock, gtod;267 u64 now, clock, old_clock, min_clock, max_clock, gtod;
268 s64 delta;268 s64 delta;
@@ -295,7 +295,7 @@ again: · 26 unmodified lines
295 return clock;295 return clock;
296}296}
297 297
298static u64 sched_clock_remote(struct sched_clock_data *scd)298notrace static u64 sched_clock_remote(struct sched_clock_data *scd)
299{299{
300 struct sched_clock_data *my_scd = this_scd();300 struct sched_clock_data *my_scd = this_scd();
301 u64 this_clock, remote_clock;301 u64 this_clock, remote_clock;
@@ -362,7 +362,7 @@ again: · 60 unmodified lines
362 *362 *
363 * See cpu_clock().363 * See cpu_clock().
364 */364 */
365u64 sched_clock_cpu(int cpu)365notrace u64 sched_clock_cpu(int cpu)
366{366{
367 struct sched_clock_data *scd;367 struct sched_clock_data *scd;
368 u64 clock;368 u64 clock;
@@ -386,7 +386,7 @@ u64 sched_clock_cpu(int cpu) · 17 unmodified lines
386}386}
387EXPORT_SYMBOL_GPL(sched_clock_cpu);387EXPORT_SYMBOL_GPL(sched_clock_cpu);
388 388
389void sched_clock_tick(void)389notrace void sched_clock_tick(void)
390{390{
391 struct sched_clock_data *scd;391 struct sched_clock_data *scd;
392 392
@@ -403,7 +403,7 @@ void sched_clock_tick(void) · 10 unmodified lines
403 sched_clock_local(scd);403 sched_clock_local(scd);
404}404}
405 405
406void sched_clock_tick_stable(void)406notrace void sched_clock_tick_stable(void)
407{407{
408 if (!sched_clock_stable())408 if (!sched_clock_stable())
409 return;409 return;
@@ -423,7 +423,7 @@ void sched_clock_tick_stable(void) · 13 unmodified lines
423/*423/*
424 * We are going deep-idle (irqs are disabled):424 * We are going deep-idle (irqs are disabled):
425 */425 */
426void sched_clock_idle_sleep_event(void)426notrace void sched_clock_idle_sleep_event(void)
427{427{
428 sched_clock_cpu(smp_processor_id());428 sched_clock_cpu(smp_processor_id());
429}429}
@@ -432,7 +432,7 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_sleep_event); · 2 unmodified lines
432/*432/*
433 * We just idled; resync with ktime.433 * We just idled; resync with ktime.
434 */434 */
435void sched_clock_idle_wakeup_event(void)435notrace void sched_clock_idle_wakeup_event(void)
436{436{
437 unsigned long flags;437 unsigned long flags;
438 438
@@ -458,7 +458,7 @@ void __init sched_clock_init(void) · 19 unmodified lines
458 local_irq_enable();458 local_irq_enable();
459}459}
460 460
461u64 sched_clock_cpu(int cpu)461notrace u64 sched_clock_cpu(int cpu)
462{462{
463 if (!static_branch_likely(&sched_clock_running))463 if (!static_branch_likely(&sched_clock_running))
464 return 0;464 return 0;
@@ -476,7 +476,7 @@ u64 sched_clock_cpu(int cpu) · 11 unmodified lines
476 * On bare metal this function should return the same as local_clock.476 * On bare metal this function should return the same as local_clock.
477 * Architectures and sub-architectures can override this.477 * Architectures and sub-architectures can override this.
478 */478 */
479u64 __weak running_clock(void)479notrace u64 __weak running_clock(void)
480{480{
481 return local_clock();481 return local_clock();
482}482}

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