aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2020-11-12 11:35:45 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2020-11-30 23:47:55 +0100
commit8e3981354ab30a6ee845f6a5487d455bb906f83e (patch)
tree3b0c67b5e3c676f60f871cf1a9dfcc6c1b82b715
parenta630fd46e9deabeddb11b4bbeb177fc78a31e8a1 (diff)
downloadbackports-8e3981354ab30a6ee845f6a5487d455bb906f83e.tar.gz
backports: add sched_set_fifo_low
It is needed for mt76. This was added in upsteram Linux commit 7318d4cc14c8 ("sched: Provide sched_set_fifo()") Signed-off-by: Felix Fietkau <nbd@nbd.name> [Use WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sparam) != 0); instead] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/sched.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/backport/backport-include/linux/sched.h b/backport/backport-include/linux/sched.h
new file mode 100644
index 00000000..36263857
--- /dev/null
+++ b/backport/backport-include/linux/sched.h
@@ -0,0 +1,20 @@
+#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)
+#if LINUX_VERSION_IS_GEQ(4,11,0)
+#include <uapi/linux/sched/types.h>
+#endif
+
+static inline void sched_set_fifo_low(struct task_struct *p)
+{
+ struct sched_param sparam = {.sched_priority = 1};
+
+ WARN_ON_ONCE(sched_setscheduler_nocheck(p, SCHED_FIFO, &sparam) != 0);
+}
+
+#endif /* < 5.9.0 */
+#endif /* __BACKPORT_LINUX_SCHED_H */