We no longer need them as we can use DWARF debug info or BTF + pahole to re-generate the required structs to compile against them for a given kernel. This moves the burden of maintaining these helper functions to the module. https://github.com/qais-yousef/sched_tp Note that pahole v1.15 is required at least for using DWARF. And for BTF v1.23 which is not yet released will be required. There's alignment problem that will lead to crashes in earlier versions when used with BTF. We should have enough infrastructure to make these helper functions now obsolete, so remove them. [Rewrote commit message to reflect the new alternative] Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Qais Yousef <qais.yousef@arm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20220428144338.479094-2-qais.yousef@arm.com
Showing the changes to kernel (1 of 2 files). Show all
Unified · Split
| @@ -11839,101 +11839,3 @@ __init void init_sched_fair_class(void) · 11838 unmodified lines | |||
| 11839 | #endif /* SMP */ | 11839 | #endif /* SMP */ |
| 11840 | 11840 | ||
| 11841 | } | 11841 | } |
| 11842 | |||
| 11843 | /* | ||
| 11844 | * Helper functions to facilitate extracting info from tracepoints. | ||
| 11845 | */ | ||
| 11846 | |||
| 11847 | const struct sched_avg *sched_trace_cfs_rq_avg(struct cfs_rq *cfs_rq) | ||
| 11848 | { | ||
| 11849 | #ifdef CONFIG_SMP | ||
| 11850 | return cfs_rq ? &cfs_rq->avg : NULL; | ||
| 11851 | #else | ||
| 11852 | return NULL; | ||
| 11853 | #endif | ||
| 11854 | } | ||
| 11855 | EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_avg); | ||
| 11856 | |||
| 11857 | char *sched_trace_cfs_rq_path(struct cfs_rq *cfs_rq, char *str, int len) | ||
| 11858 | { | ||
| 11859 | if (!cfs_rq) { | ||
| 11860 | if (str) | ||
| 11861 | strlcpy(str, "(null)", len); | ||
| 11862 | else | ||
| 11863 | return NULL; | ||
| 11864 | } | ||
| 11865 | |||
| 11866 | cfs_rq_tg_path(cfs_rq, str, len); | ||
| 11867 | return str; | ||
| 11868 | } | ||
| 11869 | EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_path); | ||
| 11870 | |||
| 11871 | int sched_trace_cfs_rq_cpu(struct cfs_rq *cfs_rq) | ||
| 11872 | { | ||
| 11873 | return cfs_rq ? cpu_of(rq_of(cfs_rq)) : -1; | ||
| 11874 | } | ||
| 11875 | EXPORT_SYMBOL_GPL(sched_trace_cfs_rq_cpu); | ||
| 11876 | |||
| 11877 | const struct sched_avg *sched_trace_rq_avg_rt(struct rq *rq) | ||
| 11878 | { | ||
| 11879 | #ifdef CONFIG_SMP | ||
| 11880 | return rq ? &rq->avg_rt : NULL; | ||
| 11881 | #else | ||
| 11882 | return NULL; | ||
| 11883 | #endif | ||
| 11884 | } | ||
| 11885 | EXPORT_SYMBOL_GPL(sched_trace_rq_avg_rt); | ||
| 11886 | |||
| 11887 | const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq) | ||
| 11888 | { | ||
| 11889 | #ifdef CONFIG_SMP | ||
| 11890 | return rq ? &rq->avg_dl : NULL; | ||
| 11891 | #else | ||
| 11892 | return NULL; | ||
| 11893 | #endif | ||
| 11894 | } | ||
| 11895 | EXPORT_SYMBOL_GPL(sched_trace_rq_avg_dl); | ||
| 11896 | |||
| 11897 | const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq) | ||
| 11898 | { | ||
| 11899 | #if defined(CONFIG_SMP) && defined(CONFIG_HAVE_SCHED_AVG_IRQ) | ||
| 11900 | return rq ? &rq->avg_irq : NULL; | ||
| 11901 | #else | ||
| 11902 | return NULL; | ||
| 11903 | #endif | ||
| 11904 | } | ||
| 11905 | EXPORT_SYMBOL_GPL(sched_trace_rq_avg_irq); | ||
| 11906 | |||
| 11907 | int sched_trace_rq_cpu(struct rq *rq) | ||
| 11908 | { | ||
| 11909 | return rq ? cpu_of(rq) : -1; | ||
| 11910 | } | ||
| 11911 | EXPORT_SYMBOL_GPL(sched_trace_rq_cpu); | ||
| 11912 | |||
| 11913 | int sched_trace_rq_cpu_capacity(struct rq *rq) | ||
| 11914 | { | ||
| 11915 | return rq ? | ||
| 11916 | #ifdef CONFIG_SMP | ||
| 11917 | rq->cpu_capacity | ||
| 11918 | #else | ||
| 11919 | SCHED_CAPACITY_SCALE | ||
| 11920 | #endif | ||
| 11921 | : -1; | ||
| 11922 | } | ||
| 11923 | EXPORT_SYMBOL_GPL(sched_trace_rq_cpu_capacity); | ||
| 11924 | |||
| 11925 | const struct cpumask *sched_trace_rd_span(struct root_domain *rd) | ||
| 11926 | { | ||
| 11927 | #ifdef CONFIG_SMP | ||
| 11928 | return rd ? rd->span : NULL; | ||
| 11929 | #else | ||
| 11930 | return NULL; | ||
| 11931 | #endif | ||
| 11932 | } | ||
| 11933 | EXPORT_SYMBOL_GPL(sched_trace_rd_span); | ||
| 11934 | |||
| 11935 | int sched_trace_rq_nr_running(struct rq *rq) | ||
| 11936 | { | ||
| 11937 | return rq ? rq->nr_running : -1; | ||
| 11938 | } | ||
| 11939 | EXPORT_SYMBOL_GPL(sched_trace_rq_nr_running); | ||