sched: enforce ref-counting on current task/thread pointers
This commit is contained in:
+4
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user