net: move xmit_recursion to per-task variable on -RT

ported to 5.9. original commit
6a66ae877a187c6c34abfd0aae2bacf6dd1ccb00

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jan Sondhauss <jan.sondhauss@wago.com>
This commit is contained in:
Sebastian Andrzej Siewior
2016-01-11 17:04:48 +01:00
committed by Oleg Karfich
parent 787942eb58
commit 45a01e1ef9
3 changed files with 25 additions and 0 deletions
+17
View File
@@ -3284,24 +3284,41 @@ DECLARE_PER_CPU_ALIGNED(struct softnet_data, softnet_data);
static inline int dev_recursion_level(void)
{
#ifdef CONFIG_PREEMPT_RT
return atomic_read(&current->xmit_recursion);
#else
return this_cpu_read(softnet_data.xmit.recursion);
#endif
}
#define XMIT_RECURSION_LIMIT 8
static inline bool dev_xmit_recursion(void)
{
#ifdef CONFIG_PREEMPT_RT
return unlikely(atomic_read(&current->xmit_recursion) >
XMIT_RECURSION_LIMIT);
#else
return unlikely(__this_cpu_read(softnet_data.xmit.recursion) >
XMIT_RECURSION_LIMIT);
#endif
}
static inline void dev_xmit_recursion_inc(void)
{
#ifdef CONFIG_PREEMPT_RT
atomic_inc(&current->xmit_recursion);
#else
__this_cpu_inc(softnet_data.xmit.recursion);
#endif
}
static inline void dev_xmit_recursion_dec(void)
{
#ifdef CONFIG_PREEMPT_RT
atomic_dec(&current->xmit_recursion);
#else
__this_cpu_dec(softnet_data.xmit.recursion);
#endif
}
void __netif_schedule(struct Qdisc *q);
+4
View File
@@ -1539,6 +1539,10 @@ struct task_struct {
struct user_event_mm *user_event_mm;
#endif
#ifdef CONFIG_PREEMPT_RT
atomic_t xmit_recursion;
#endif
/*
* New fields for task_struct should be added above here, so that
* they are included in the randomized portion of task_struct.
+4
View File
@@ -1166,6 +1166,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
tsk->wake_q.next = NULL;
tsk->worker_private = NULL;
#ifdef CONFIG_PREEMPT_RT
atomic_set(&tsk->xmit_recursion, 0);
#endif
kcov_task_init(tsk);
kmsan_task_create(tsk);
kmap_local_fork(tsk);