aboutsummaryrefslogtreecommitdiffstats
path: root/features/rt/locking-split-out-the-rbtree-definition.patch
diff options
context:
space:
mode:
Diffstat (limited to 'features/rt/locking-split-out-the-rbtree-definition.patch')
-rw-r--r--features/rt/locking-split-out-the-rbtree-definition.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/features/rt/locking-split-out-the-rbtree-definition.patch b/features/rt/locking-split-out-the-rbtree-definition.patch
new file mode 100644
index 00000000..8af42b5d
--- /dev/null
+++ b/features/rt/locking-split-out-the-rbtree-definition.patch
@@ -0,0 +1,119 @@
+From e13218659647185acc44046be640f023fd392f7b Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Fri, 14 Aug 2020 17:08:41 +0200
+Subject: [PATCH 071/191] locking: split out the rbtree definition
+
+rtmutex.h needs the definition for rb_root_cached. By including kernel.h
+we will get to spinlock.h which requires rtmutex.h again.
+
+Split out the required struct definition and move it into its own header
+file which can be included by rtmutex.h
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+---
+ include/linux/rbtree.h | 27 +--------------------------
+ include/linux/rbtree_type.h | 31 +++++++++++++++++++++++++++++++
+ include/linux/rtmutex.h | 2 +-
+ 3 files changed, 33 insertions(+), 27 deletions(-)
+ create mode 100644 include/linux/rbtree_type.h
+
+diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
+index d31ecaf4fdd3..e711efc2e009 100644
+--- a/include/linux/rbtree.h
++++ b/include/linux/rbtree.h
+@@ -19,19 +19,9 @@
+
+ #include <linux/kernel.h>
+ #include <linux/stddef.h>
++#include <linux/rbtree_type.h>
+ #include <linux/rcupdate.h>
+
+-struct rb_node {
+- unsigned long __rb_parent_color;
+- struct rb_node *rb_right;
+- struct rb_node *rb_left;
+-} __attribute__((aligned(sizeof(long))));
+- /* The alignment might seem pointless, but allegedly CRIS needs it */
+-
+-struct rb_root {
+- struct rb_node *rb_node;
+-};
+-
+ #define rb_parent(r) ((struct rb_node *)((r)->__rb_parent_color & ~3))
+
+ #define RB_ROOT (struct rb_root) { NULL, }
+@@ -112,21 +102,6 @@ static inline void rb_link_node_rcu(struct rb_node *node, struct rb_node *parent
+ typeof(*pos), field); 1; }); \
+ pos = n)
+
+-/*
+- * Leftmost-cached rbtrees.
+- *
+- * We do not cache the rightmost node based on footprint
+- * size vs number of potential users that could benefit
+- * from O(1) rb_last(). Just not worth it, users that want
+- * this feature can always implement the logic explicitly.
+- * Furthermore, users that want to cache both pointers may
+- * find it a bit asymmetric, but that's ok.
+- */
+-struct rb_root_cached {
+- struct rb_root rb_root;
+- struct rb_node *rb_leftmost;
+-};
+-
+ #define RB_ROOT_CACHED (struct rb_root_cached) { {NULL, }, NULL }
+
+ /* Same as rb_first(), but O(1) */
+diff --git a/include/linux/rbtree_type.h b/include/linux/rbtree_type.h
+new file mode 100644
+index 000000000000..77a89dd2c7c6
+--- /dev/null
++++ b/include/linux/rbtree_type.h
+@@ -0,0 +1,31 @@
++/* SPDX-License-Identifier: GPL-2.0-or-later */
++#ifndef _LINUX_RBTREE_TYPE_H
++#define _LINUX_RBTREE_TYPE_H
++
++struct rb_node {
++ unsigned long __rb_parent_color;
++ struct rb_node *rb_right;
++ struct rb_node *rb_left;
++} __attribute__((aligned(sizeof(long))));
++/* The alignment might seem pointless, but allegedly CRIS needs it */
++
++struct rb_root {
++ struct rb_node *rb_node;
++};
++
++/*
++ * Leftmost-cached rbtrees.
++ *
++ * We do not cache the rightmost node based on footprint
++ * size vs number of potential users that could benefit
++ * from O(1) rb_last(). Just not worth it, users that want
++ * this feature can always implement the logic explicitly.
++ * Furthermore, users that want to cache both pointers may
++ * find it a bit asymmetric, but that's ok.
++ */
++struct rb_root_cached {
++ struct rb_root rb_root;
++ struct rb_node *rb_leftmost;
++};
++
++#endif
+diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
+index add1dab27df5..b828b938c876 100644
+--- a/include/linux/rtmutex.h
++++ b/include/linux/rtmutex.h
+@@ -14,7 +14,7 @@
+ #define __LINUX_RT_MUTEX_H
+
+ #include <linux/linkage.h>
+-#include <linux/rbtree.h>
++#include <linux/rbtree_type.h>
+ #include <linux/spinlock_types_raw.h>
+
+ extern int max_lock_depth; /* for sysctl */
+--
+2.19.1
+