Skip to content

Commit a748db0

Browse files
committed
tools/sched_ext: Receive misc updates from SCX repo
Receive misc tools/sched_ext updates from https://github.com/sched-ext/scx to sync userspace bits. - LSP macros to help language servers. - bpf_cpumask_weight() declaration and cast_mask() helper. - Cosmetic updates to scx_flatcg.bpf.c. Signed-off-by: Tejun Heo <[email protected]>
1 parent 1e123fd commit a748db0

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

tools/sched_ext/include/scx/common.bpf.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
#ifndef __SCX_COMMON_BPF_H
88
#define __SCX_COMMON_BPF_H
99

10+
#ifdef LSP
11+
#define __bpf__
12+
#include "../vmlinux/vmlinux.h"
13+
#else
1014
#include "vmlinux.h"
15+
#endif
16+
1117
#include <bpf/bpf_helpers.h>
1218
#include <bpf/bpf_tracing.h>
1319
#include <asm-generic/errno.h>
@@ -309,6 +315,15 @@ void bpf_cpumask_copy(struct bpf_cpumask *dst, const struct cpumask *src) __ksym
309315
u32 bpf_cpumask_any_distribute(const struct cpumask *cpumask) __ksym;
310316
u32 bpf_cpumask_any_and_distribute(const struct cpumask *src1,
311317
const struct cpumask *src2) __ksym;
318+
u32 bpf_cpumask_weight(const struct cpumask *cpumask) __ksym;
319+
320+
/*
321+
* Access a cpumask in read-only mode (typically to check bits).
322+
*/
323+
const struct cpumask *cast_mask(struct bpf_cpumask *mask)
324+
{
325+
return (const struct cpumask *)mask;
326+
}
312327

313328
/* rcu */
314329
void bpf_rcu_read_lock(void) __ksym;

tools/sched_ext/include/scx/user_exit_info.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ struct user_exit_info {
2525

2626
#ifdef __bpf__
2727

28+
#ifdef LSP
29+
#include "../vmlinux/vmlinux.h"
30+
#else
2831
#include "vmlinux.h"
32+
#endif
2933
#include <bpf/bpf_core_read.h>
3034

3135
#define UEI_DEFINE(__name) \

tools/sched_ext/scx_flatcg.bpf.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static void cgrp_refresh_hweight(struct cgroup *cgrp, struct fcg_cgrp_ctx *cgc)
225225
break;
226226

227227
/*
228-
* We can be oppotunistic here and not grab the
228+
* We can be opportunistic here and not grab the
229229
* cgv_tree_lock and deal with the occasional races.
230230
* However, hweight updates are already cached and
231231
* relatively low-frequency. Let's just do the
@@ -258,8 +258,7 @@ static void cgrp_cap_budget(struct cgv_node *cgv_node, struct fcg_cgrp_ctx *cgc)
258258
* and thus can't be updated and repositioned. Instead, we collect the
259259
* vtime deltas separately and apply it asynchronously here.
260260
*/
261-
delta = cgc->cvtime_delta;
262-
__sync_fetch_and_sub(&cgc->cvtime_delta, delta);
261+
delta = __sync_fetch_and_sub(&cgc->cvtime_delta, cgc->cvtime_delta);
263262
cvtime = cgv_node->cvtime + delta;
264263

265264
/*

0 commit comments

Comments
 (0)