backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] backports: add sched_set_fifo_low
@ 2020-11-12 10:35 Felix Fietkau
  2020-11-12 10:35 ` [PATCH 2/2] backports: add tasklet_setup, from_tasklet Felix Fietkau
  2020-11-15 14:12 ` [PATCH 1/2] backports: add sched_set_fifo_low Hauke Mehrtens
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Fietkau @ 2020-11-12 10:35 UTC (permalink / raw)
  To: backports

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);
+}
+
+#endif
+
+#endif
-- 
2.28.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] backports: add tasklet_setup, from_tasklet
  2020-11-12 10:35 [PATCH 1/2] backports: add sched_set_fifo_low Felix Fietkau
@ 2020-11-12 10:35 ` Felix Fietkau
  2020-11-15 14:12 ` [PATCH 1/2] backports: add sched_set_fifo_low Hauke Mehrtens
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Fietkau @ 2020-11-12 10:35 UTC (permalink / raw)
  To: backports

Add the new tasklet API

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 backport/backport-include/linux/interrupt.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/backport/backport-include/linux/interrupt.h b/backport/backport-include/linux/interrupt.h
index f7e7134d8338..f334a9636180 100644
--- a/backport/backport-include/linux/interrupt.h
+++ b/backport/backport-include/linux/interrupt.h
@@ -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 */
-- 
2.28.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] backports: add sched_set_fifo_low
  2020-11-12 10:35 [PATCH 1/2] backports: add sched_set_fifo_low Felix Fietkau
  2020-11-12 10:35 ` [PATCH 2/2] backports: add tasklet_setup, from_tasklet Felix Fietkau
@ 2020-11-15 14:12 ` Hauke Mehrtens
  1 sibling, 0 replies; 3+ messages in thread
From: Hauke Mehrtens @ 2020-11-15 14:12 UTC (permalink / raw)
  To: Felix Fietkau, backports

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-15 14:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12 10:35 [PATCH 1/2] backports: add sched_set_fifo_low Felix Fietkau
2020-11-12 10:35 ` [PATCH 2/2] backports: add tasklet_setup, from_tasklet Felix Fietkau
2020-11-15 14:12 ` [PATCH 1/2] backports: add sched_set_fifo_low Hauke Mehrtens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).