sched: enforce ref-counting on current task/thread pointers

This commit is contained in:
2026-04-01 18:17:05 +01:00
parent 15c2207ab9
commit 512356ac2d
28 changed files with 364 additions and 103 deletions
+4 -2
View File
@@ -215,18 +215,19 @@ void schedule_thread_on_cpu(struct thread *thr)
void start_charge_period(void)
{
struct thread *self = current_thread();
struct thread *self = get_current_thread();
if (!self) {
return;
}
self->tr_charge_period_start = get_cycles();
put_current_thread(self);
}
void end_charge_period(void)
{
preempt_disable();
struct thread *self = current_thread();
struct thread *self = get_current_thread();
if (!self) {
return;
}
@@ -244,6 +245,7 @@ void end_charge_period(void)
}
self->tr_charge_period_start = 0;
put_current_thread(self);
// printk("%llu cycles charged to %s/%u", charge,
// self->tr_parent->t_name, self->tr_parent->t_id);