Steven Barrett commented on issue #110 at Alfred Chen / linux-prjc

Steven Barrett
2025-06-18T13:18:17Z

Here's my workaround here: https://github.com/zen-kernel/zen-kernel/commit/74f8cdbe54652203f1a91b75d6b1f44c3fa38331

As you found out, tsk_seruntime(p) is used instead of p->se.sum_exec_runtime. As for p->se.exec_start, I found a reference in kernel/sched/core.c that had a direct replacement in alt_core.c as p->last_ran.

No idea if the patch will work as intended but it fixes the build error.

From 74f8cdbe54652203f1a91b75d6b1f44c3fa38331 Mon Sep 17 00:00:00 2001
From: Steven Barrett <steven@liquorix.net>
Date: Tue, 17 Jun 2025 18:23:47 -0500
Subject: [PATCH] sched/alt: fs/bcachefs: Add support for Project-C in
__wp_update_state

---
fs/bcachefs/io_write.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
index c1237da079ede2..b05ce0bef794cf 100644
--- a/fs/bcachefs/io_write.c
+++ b/fs/bcachefs/io_write.c
@@ -625,8 +625,14 @@ static inline void __wp_update_state(struct write_point *wp, enum write_point_st
if (state != wp->state) {
struct task_struct *p = current;
u64 now = ktime_get_ns();
+
+#ifdef CONFIG_SCHED_ALT
+ u64 runtime = tsk_seruntime(p) +
+ (now - p->last_ran);
+#else
u64 runtime = p->se.sum_exec_runtime +
(now - p->se.exec_start);
+#endif

if (state == WRITE_POINT_runnable)
wp->last_runtime = runtime;