backports: add sched_set_fifo_low
PATCH 2/2 backports: add tasklet_setup, from_tasklet
In reply to Felix FietkauAdd the new tasklet API
Signed-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/interrupt.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
backport/backport-include/linux/interrupt.h +17 -0
@@ -31,6 +31,23 @@ static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,hrtimer_start (timer, _time, mode); }#define hrtimer_start LINUX_BACKPORT(hrtimer_start) + +#endif + +#if LINUX_VERSION_IS_LESS (5 ,9 ,0 ) + +static inline void +tasklet_setup (struct tasklet_struct *t, +void (*callback)(struct tasklet_struct *)) +{ +void (*cb)(unsigned long data) = (void *)callback; + +tasklet_init (t, cb, (unsigned long )t); +} + +#define from_tasklet (var, callback_tasklet, tasklet_fieldname) \ + container_of(callback_tasklet, typeof(*var), tasklet_fieldname) +#endif #endif /* _BP_LINUX_INTERRUPT_H */
Signature · 4 lines
2.28.0 -- To unsubscribe from this list: send the line "unsubscribe backports" in
PATCH 1/2 backports: add sched_set_fifo_low
It is needed for mt76
Signed-off-by Felix Fietkau <[email protected]>
--- backport/backport-include/linux/sched.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backport/backport-include/linux/sched.h
backport/backport-include/linux/sched.h new file +19 -0
@@ -0,0 +1,19 @@ +#ifndef __BACKPORT_LINUX_SCHED_H +#define __BACKPORT_LINUX_SCHED_H + +#include_next <linux/sched.h> +#include <linux/version.h> + +#if LINUX_VERSION_IS_LESS (5 ,9 ,0 ) +#include <uapi/linux/sched/types.h> + +static inline void sched_set_fifo_low (struct task_struct *p) +{ +struct sched_param sparam = {.sched_priority =1 }; + +sched_setscheduler (p,SCHED_FIFO , &sparam); +} + +#endif + +#endif
Signature · 4 lines
2.28.0 -- To unsubscribe from this list: send the line "unsubscribe backports" in
Quoted 18 lines · Felix Fietkau
It is needed for mt76
Signed-off-by Felix Fietkau <[email protected]>--- backport/backport-include/linux/sched.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)create mode 100644
backport/backport-include/linux/sched.hbackport/backport-include/linux/sched.h new file +4
-0@@ -0,0 +1,19 @@ +#ifndef __BACKPORT_LINUX_SCHED_H +#define __BACKPORT_LINUX_SCHED_H + +#include_next <linux/sched.h>
backport/backport-include/linux/sched.h line 14
Quoted 10 lines
backport/backport-include/linux/sched.h new file +10
-0+#include <linux/version.h> + +#if LINUX_VERSION_IS_LESS (5 ,9 ,0 ) +#include <uapi/linux/sched/types.h> + +static inline void sched_set_fifo_low (struct task_struct *p) +{ +struct sched_param sparam = {.sched_priority =1 }; + +sched_setscheduler (p,SCHED_FIFO , &sparam);
Hi Felix,
The upstream kernel uses this in sched_set_fifo_low():
WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sp) != 0);
See:
https://elixir.bootlin.com/linux/v5.10-rc3/source/kernel/sched/core.c#L5570
Did you change this intentionally?
Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in