[<prev] [next>] [day] [month] [year] [list]
Message-ID: <169537033408.27769.12070730521509427015.tip-bot2@tip-bot2>
Date: Fri, 22 Sep 2023 08:12:14 -0000
From: "tip-bot2 for Ingo Molnar" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Ingo Molnar <mingo@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org, x86@...nel.org
Subject: [tip: sched/core] <linux/list.h>: Introduce the
list_for_each_reverse() method
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 8bf0cdfac7f8aa3fa6151b5c5f5eebdb44a64e89
Gitweb: https://git.kernel.org/tip/8bf0cdfac7f8aa3fa6151b5c5f5eebdb44a64e89
Author: Ingo Molnar <mingo@...nel.org>
AuthorDate: Thu, 21 Sep 2023 11:32:58 +02:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Fri, 22 Sep 2023 09:38:42 +02:00
<linux/list.h>: Introduce the list_for_each_reverse() method
The list_head counterpart of list_for_each_entry_reverse() was missing,
add it to complete the list handling APIs in <linux/list.h>.
[ This new API is also relied on by a WIP scheduler patch, so this
variant is not a theoretical possibility only. ]
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org
---
include/linux/list.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/list.h b/include/linux/list.h
index 164b4d0..1837cae 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -687,6 +687,14 @@ static inline void list_splice_tail_init(struct list_head *list,
for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
/**
+ * list_for_each_reverse - iterate backwards over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ */
+#define list_for_each_reverse(pos, head) \
+ for (pos = (head)->prev; pos != (head); pos = pos->prev)
+
+/**
* list_for_each_rcu - Iterate over a list in an RCU-safe fashion
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.
Powered by blists - more mailing lists