In current kernel, there are several places which need to check whether there is a persistent clock for the platform. Current check is done by calling the read_persistent_clock() and validating its return value. So one optimization is to do the check only once in timekeeping_init(), and use a flag persistent_clock_exist to record it. v2: Add a has_persistent_clock() helper function, as suggested by John.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -115,6 +115,12 @@ static inline bool timespec_valid_strict(const struct timespec *ts) · 114 unmodified lines | ||
| 115 | 115 | return true; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | +extern bool persistent_clock_exist; | |
| 119 | +static inline bool has_persistent_clock(void) | |
| 120 | +{ | |
| 121 | + return persistent_clock_exist; | |
| 122 | +} | |
| 123 | + | |
| 118 | 124 | extern void read_persistent_clock(struct timespec *ts); |
| 119 | 125 | extern void read_boot_clock(struct timespec *ts); |
| 120 | 126 | extern int update_persistent_clock(struct timespec now); |