@@ -21,10 +21,6 @@ struct kthread {
2121
2222#define EASY_MAX_TASKS 8192
2323
24- // static struct task_struct **tasks = NULL;
25- // static int task_count = 0;
26- // static int current_index = 0;
27-
2824typedef struct {
2925 struct task_struct * * tasks ;
3026 int task_count ;
@@ -33,12 +29,26 @@ typedef struct {
3329
3430easy_sched_struct_def easy_cpu_contexts [128 ] = {0 };
3531
32+ __inline void egg (void )
33+ {
34+ static uint8_t shown = 0 ;
35+ if (shown ) return ;
36+ const char * unix_day [] = {"Thursday" , "Friday" , "Saturday" , "Sunday" , "Monday" , "Tuesday" , "Wednesday" };
37+ pr_alert ("easy_sched: From Beijing to Hiroshima, Professors kept saying the same thing:\n" );
38+ pr_alert ("easy_sched: 'Your math is too poor!'\n" );
39+ pr_alert ("easy_sched: But every time they said it, I had already deleted their math-heavy bullshit,\n" );
40+ pr_alert ("easy_sched: and the system still ran — faster, cleaner, simpler.\n" );
41+ pr_alert ("!!! Happy %s !!!\n" , unix_day [(__ktime_get_real_seconds ()/86400 )%7 ]);
42+ shown = 1 ;
43+ }
44+
3645void easy_sched_init (easy_sched_struct_def * easy_context )
3746{
3847 easy_context -> tasks = kmalloc_array (EASY_MAX_TASKS , sizeof (void * ), GFP_KERNEL );
3948 if (!easy_context -> tasks ) BUG ();
4049 memset (easy_context -> tasks , 0 , EASY_MAX_TASKS * sizeof (void * ));
4150 pr_alert ("!!! easy_sched_init succ !!!\n" );
51+ egg ();
4252}
4353
4454static void enqueue_task_easy (struct rq * rq , struct task_struct * p , int flags )
@@ -105,7 +115,7 @@ static void yield_task_easy(struct rq *rq)
105115 easy_context -> index ++ ;
106116}
107117
108- static void put_prev_task_easy (struct rq * rq , struct task_struct * p ) {}
118+ static void put_prev_task_easy (struct rq * rq , struct task_struct * p ) { }
109119static void set_next_task_easy (struct rq * rq , struct task_struct * p , bool first ) { }
110120static void check_preempt_curr_easy (struct rq * rq , struct task_struct * p , int flags ) { }
111121static void task_tick_easy (struct rq * rq , struct task_struct * p , int queued ) { }
@@ -154,36 +164,28 @@ DEFINE_SCHED_CLASS(easy) =
154164 .dequeue_task = dequeue_task_easy ,
155165 .yield_task = yield_task_easy ,
156166 .yield_to_task = yield_to_task_easy ,
157-
158- .check_preempt_curr = check_preempt_curr_easy ,
159-
160167 .pick_next_task = pick_next_task_easy ,
161168 .put_prev_task = put_prev_task_easy ,
162169 .set_next_task = set_next_task_easy ,
163-
170+ . check_preempt_curr = check_preempt_curr_easy ,
164171#ifdef CONFIG_SMP
165172 .balance = balance_easy ,
166173 .pick_task = pick_next_task_easy ,
167174 .select_task_rq = select_task_rq_easy ,
168175 .migrate_task_rq = migrate_task_rq_easy ,
169-
170176 .rq_online = rq_online_easy ,
171177 .rq_offline = rq_offline_easy ,
172-
173178 .task_dead = task_dead_easy ,
174179 .set_cpus_allowed = set_cpus_allowed_common ,
175180#endif
176-
177181 .task_tick = task_tick_easy ,
178182 .task_fork = task_fork_easy ,
179-
180183 .prio_changed = prio_changed_easy ,
181184 .switched_from = switched_from_easy ,
182185 .switched_to = switched_to_easy ,
183-
184186 .get_rr_interval = get_rr_interval_easy ,
185187 .update_curr = update_curr_easy ,
186188#ifdef CONFIG_SCHED_CORE
187189 .task_is_throttled = task_is_throttled_easy ,
188190#endif
189- };
191+ };
0 commit comments