diff mbox series

[1/2] backports: add sched_set_fifo_low

Message ID 20201112103546.74014-1-nbd@nbd.name (mailing list archive)
State New, archived
Headers show
Series [1/2] backports: add sched_set_fifo_low | expand

Commit Message

Felix Fietkau Nov. 12, 2020, 10:35 a.m. UTC
It is needed for mt76

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/sched.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 backport/backport-include/linux/sched.h

Comments

Hauke Mehrtens Nov. 15, 2020, 2:12 p.m. UTC | #1
On 11/12/20 11:35 AM, Felix Fietkau wrote:
> It is needed for mt76
> 
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>   backport/backport-include/linux/sched.h | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
>   create mode 100644 backport/backport-include/linux/sched.h
> 
> diff --git a/backport/backport-include/linux/sched.h b/backport/backport-include/linux/sched.h
> new file mode 100644
> index 000000000000..be77a8d771ab
> --- /dev/null
> +++ b/backport/backport-include/linux/sched.h
> @@ -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);

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
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 000000000000..be77a8d771ab
--- /dev/null
+++ b/backport/backport-include/linux/sched.h
@@ -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