Mark threads out of CPU by kernel events
This commit is contained in:
parent
d1312ff6e9
commit
31fa1508f7
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#include "kernel_priv.h"
|
#include "kernel_priv.h"
|
||||||
@ -19,8 +19,10 @@ context_switch(struct emu *emu)
|
|||||||
|
|
||||||
switch (emu->ev->v) {
|
switch (emu->ev->v) {
|
||||||
case 'O':
|
case 'O':
|
||||||
|
emu->thread->is_out_of_cpu = 1;
|
||||||
return chan_push(ch, value_int64(ST_CSOUT));
|
return chan_push(ch, value_int64(ST_CSOUT));
|
||||||
case 'I':
|
case 'I':
|
||||||
|
emu->thread->is_out_of_cpu = 0;
|
||||||
return chan_pop(ch, value_int64(ST_CSOUT));
|
return chan_pop(ch, value_int64(ST_CSOUT));
|
||||||
default:
|
default:
|
||||||
err("unknown context switch event");
|
err("unknown context switch event");
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
|
/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later */
|
* SPDX-License-Identifier: GPL-3.0-or-later */
|
||||||
|
|
||||||
#ifndef THREAD_H
|
#ifndef THREAD_H
|
||||||
@ -54,6 +54,9 @@ struct thread {
|
|||||||
int is_running;
|
int is_running;
|
||||||
int is_active;
|
int is_active;
|
||||||
|
|
||||||
|
/* Out of CPU as informed by the kernel */
|
||||||
|
int is_out_of_cpu;
|
||||||
|
|
||||||
/* Current cpu, NULL if not unique affinity */
|
/* Current cpu, NULL if not unique affinity */
|
||||||
struct cpu *cpu;
|
struct cpu *cpu;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user