File tree Expand file tree Collapse file tree 6 files changed +504
-25
lines changed
scheds/rust/scx_mitosis/src Expand file tree Collapse file tree 6 files changed +504
-25
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ enum cell_stat_idx {
4646 NR_CSTATS ,
4747};
4848
49+ /* Function invocation counters */
50+ enum counter_idx {
51+ COUNTER_SELECT_CPU ,
52+ COUNTER_ENQUEUE ,
53+ COUNTER_DISPATCH ,
54+ NR_COUNTERS ,
55+ };
56+
4957struct cpu_ctx {
5058 u64 cstats [MAX_CELLS ][NR_CSTATS ];
5159 u64 cell_cycles [MAX_CELLS ];
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ UEI_DEFINE(uei);
4949*/
5050struct cpu_to_l3_map cpu_to_l3 SEC (".maps" );
5151struct l3_to_cpus_map l3_to_cpus SEC (".maps" );
52+
53+ /*
54+ * Maps for statistics
55+ */
56+ struct function_counters_map function_counters SEC (".maps" );
5257struct steal_stats_map steal_stats SEC (".maps" );
5358
5459/*
Original file line number Diff line number Diff line change 3737 */
3838#define MAX_CPUMASK_ENTRIES (4)
3939
40- extern const volatile u32 nr_l3 ;
41-
4240/*
4341 * We don't know how big struct cpumask is at compile time, so just allocate a
4442 * large space and check that it is big enough at runtime
43+ * TODO: This should be deduplicated with the rust code and put in intf.h
4544 */
4645#define CPUMASK_LONG_ENTRIES (128)
4746#define CPUMASK_SIZE (sizeof(long) * CPUMASK_LONG_ENTRIES)
4847
48+ extern const volatile u32 nr_l3 ;
49+
4950enum mitosis_constants {
5051 /* Invalid/unset L3 value */
5152 INVALID_L3_ID = -1 ,
@@ -102,3 +103,11 @@ struct task_ctx {
102103// These could go in mitosis.bpf.h, but we'll cross that bridge when we get
103104static inline struct cell * lookup_cell (int idx );
104105static inline const struct cpumask * lookup_cell_cpumask (int idx );
106+
107+ /* MAP TYPES */
108+ struct function_counters_map {
109+ __uint (type , BPF_MAP_TYPE_PERCPU_ARRAY );
110+ __type (key , u32 );
111+ __type (value , u64 );
112+ __uint (max_entries , NR_COUNTERS );
113+ };
You can’t perform that action at this time.
0 commit comments