diff mbox series

[05/30] backports: add sched_set_fifo_low

Message ID 20201201220415.30582-6-hauke@hauke-m.de (mailing list archive)
State New, archived
Headers show
Series backports: Update to match kernel 5.10-rc6 | expand

Commit Message

Hauke Mehrtens Dec. 1, 2020, 10:03 p.m. UTC
From: Felix Fietkau <nbd@nbd.name>

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>
---
 backport/backport-include/linux/sched.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 backport/backport-include/linux/sched.h
diff mbox series

Patch

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 */