summaryrefslogtreecommitdiff
path: root/SOURCE/module/kernel/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'SOURCE/module/kernel/load.c')
-rwxr-xr-xSOURCE/module/kernel/load.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/SOURCE/module/kernel/load.c b/SOURCE/module/kernel/load.c
index ce34668..9226117 100755
--- a/SOURCE/module/kernel/load.c
+++ b/SOURCE/module/kernel/load.c
@@ -27,6 +27,7 @@
#include <linux/rbtree.h>
#include <linux/cpu.h>
#include <linux/syscalls.h>
+#include <asm-generic/rwonce.h> // for READ_ONCE(x)
#include <asm/irq_regs.h>
@@ -79,6 +80,12 @@ void diag_load_timer(struct diag_percpu_context *context)
}
#else
+// https://www.spinics.net/lists/kernel/msg3582022.html
+// fun remove from 5.8.rc3, just for build to add it here
+#define task_contributes_to_load2(task) ((READ_ONCE(task->__state) & TASK_UNINTERRUPTIBLE) != 0 && \
+ (task->flags & PF_FROZEN) == 0 && \
+ (READ_ONCE(task->__state) & TASK_NOLOAD) == 0)
+
static void load_monitor_ipi(void *ignore)
{
struct load_monitor_cpu_run *cpu_run;
@@ -144,7 +151,7 @@ void diag_load_timer(struct diag_percpu_context *context)
rcu_read_lock();
do_each_thread(g, p) {
- if (task_contributes_to_load(p))
+ if (task_contributes_to_load2(p))
nr_uninterrupt++;
} while_each_thread(g, p);
@@ -206,8 +213,12 @@ void diag_load_timer(struct diag_percpu_context *context)
diag_variant_buffer_seal(&load_monitor_variant_buffer);
diag_variant_buffer_spin_unlock(&load_monitor_variant_buffer, flags);
do_each_thread(g, p) {
- if ((p->state == TASK_RUNNING)
- || task_contributes_to_load(p)) {
+// [[PATCH v2 7/7] sched: Change task_struct::state](https://lore.kernel.org/all/[email protected]/#r)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 13, 0)
+ if ((p->state == TASK_RUNNING) || task_contributes_to_load2(p)) {
+#else
+ if ((p->__state == TASK_RUNNING) || task_contributes_to_load2(p)) {
+#endif
tsk_info.et_type = et_load_monitor_task;
tsk_info.id = event_id;
tsk_info.tv = detail.tv;