Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #213 from vax-r/Sync
Browse files Browse the repository at this point in the history
Sync with scx repo
  • Loading branch information
htejun authored May 26, 2024
2 parents adadcf3 + 91aa073 commit 7648df7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tools/sched_ext/include/scx/common.bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ static inline u32 bpf_log2l(u64 v)
/* useful compiler attributes */
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define __maybe_unused __attribute__((__unused__))


void *bpf_obj_new_impl(__u64 local_type_id, void *meta) __ksym;
void bpf_obj_drop_impl(void *kptr, void *meta) __ksym;
Expand Down
1 change: 1 addition & 0 deletions tools/sched_ext/scx_central.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ int BPF_STRUCT_OPS_SLEEPABLE(central_init)
struct bpf_timer *timer;
int ret;

__COMPAT_scx_bpf_switch_all();
ret = scx_bpf_create_dsq(FALLBACK_DSQ_ID, -1);
if (ret)
return ret;
Expand Down
2 changes: 1 addition & 1 deletion tools/sched_ext/scx_flatcg.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* For example, B is competing against C and in that competition its share is
* 100/(100+100) == 1/2. At its parent level, A is competing against D and A's
* share in that competition is 200/(200+100) == 1/3. B's eventual share in the
* share in that competition is 100/(200+100) == 1/3. B's eventual share in the
* system can be calculated by multiplying the two shares, 1/2 * 1/3 == 1/6. C's
* eventual shaer is the same at 1/6. D is only competing at the top level and
* its share is 200/(100+200) == 2/3.
Expand Down
8 changes: 8 additions & 0 deletions tools/sched_ext/scx_simple.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ const volatile bool fifo_sched;
static u64 vtime_now;
UEI_DEFINE(uei);

/*
* Built-in DSQs such as SCX_DSQ_GLOBAL cannot be used as priority queues
* (meaning, cannot be dispatched to with scx_bpf_dispatch_vtime()). We
* therefore create a separate DSQ with ID 0 that we dispatch to and consume
* from. If scx_simple only supported global FIFO scheduling, then we could
* just use SCX_DSQ_GLOBAL.
*/
#define SHARED_DSQ 0

struct {
Expand Down Expand Up @@ -129,6 +136,7 @@ void BPF_STRUCT_OPS(simple_enable, struct task_struct *p)

s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init)
{
__COMPAT_scx_bpf_switch_all();
return scx_bpf_create_dsq(SHARED_DSQ, -1);
}

Expand Down

0 comments on commit 7648df7

Please sign in to comment.