|
1 | 1 | #include <linux/sched/clock.h> |
2 | 2 | #include <linux/sched/cputime.h> |
3 | | -#include <asm/tsc.h> |
| 3 | +#include <linux/timekeeper_internal.h> |
4 | 4 | #include <linux/sched/isolation.h> |
5 | 5 | #include <linux/sched/nohz.h> |
6 | 6 | #include "sched.h" |
@@ -39,19 +39,21 @@ static __inline void egg(void) |
39 | 39 | pr_alert("easy_sched: 'Your math is too poor!'\n"); |
40 | 40 | pr_alert("easy_sched: But every time they said it, I had already deleted their math-heavy bullshit,\n"); |
41 | 41 | pr_alert("easy_sched: and the system still ran — faster, cleaner, simpler.\n"); |
42 | | - if (__ktime_get_real_seconds()) |
43 | | - pr_alert("!!! Happy %s !!!\n", unix_days[(__ktime_get_real_seconds()/86400)%7]); |
| 42 | + if (global_timekeeper.xtime_sec) |
| 43 | + pr_alert("!!! Happy %s !!!\n", unix_days[(global_timekeeper.xtime_sec/86400)%7]); |
44 | 44 | else |
45 | 45 | pr_alert("!!! Happy ???Day, time unknown 233 !!!\n"); |
46 | 46 | shown = 1; |
47 | 47 | } |
48 | 48 | static __inline void egg2(struct task_struct *p) |
49 | 49 | { |
50 | 50 | static uint64_t last_yield = 0; |
51 | | - uint64_t now_sec = __ktime_get_real_seconds(); |
52 | | - if (now_sec-last_yield<30) return; |
53 | | - pr_alert("\033[1;31mWarning from Professors with PID=%lld: %s\033[0m\n", p->pid, prof_words[get_cycles()%(sizeof(prof_words)/sizeof(char *))]); |
54 | | - last_yield = now_sec; |
| 51 | + if (global_timekeeper.ktime_sec-last_yield<30) return; |
| 52 | + if (p->utime%255 > 233) |
| 53 | + { |
| 54 | + pr_alert("\033[1;31mWarning from Professors with PID=%lld: %s\033[0m\n", p->pid, prof_words[get_cycles()%(sizeof(prof_words)/sizeof(char *))]); |
| 55 | + last_yield = global_timekeeper.ktime_sec; |
| 56 | + } |
55 | 57 | } |
56 | 58 |
|
57 | 59 | void easy_sched_init(easy_sched_struct_def *easy_context) |
|
0 commit comments