Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1436214 > unrolled thread

[patch 4 11/22] hlist: Add hlist_is_singular_node() helper

Started byThomas Gleixner <tglx@linutronix.de>
First post2016-07-04 12:00 +0200
Last post2016-07-07 10:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [patch 4 11/22] hlist: Add hlist_is_singular_node() helper Thomas Gleixner <tglx@linutronix.de> - 2016-07-04 12:00 +0200
    [tip:timers/core] hlist: Add hlist_is_singular_node() helper tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-07-07 10:50 +0200

#1436214 — [patch 4 11/22] hlist: Add hlist_is_singular_node() helper

FromThomas Gleixner <tglx@linutronix.de>
Date2016-07-04 12:00 +0200
Subject[patch 4 11/22] hlist: Add hlist_is_singular_node() helper
Message-ID<rR8Pv-419-25@gated-at.bofh.it>
Required to figure out whether the entry is the only one in the hlist.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: rt@linutronix.de
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Arjan van de Ven <arjan@infradead.org>

---
 include/linux/list.h |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -679,6 +679,16 @@ static inline bool hlist_fake(struct hli
 }
 
 /*
+ * Check whether the node is the only node of the head without
+ * accessing head.
+ */
+static inline bool hlist_is_singular_node(struct hlist_node *n,
+					  struct hlist_head *h)
+{
+	return !n->next && n->pprev == &h->first;
+}
+
+/*
  * Move a list from one list head to another. Fixup the pprev
  * reference of the first entry if it exists.
  */

[toc] | [next] | [standalone]


#1438387 — [tip:timers/core] hlist: Add hlist_is_singular_node() helper

Fromtip-bot for Thomas Gleixner <tipbot@zytor.com>
Date2016-07-07 10:50 +0200
Subject[tip:timers/core] hlist: Add hlist_is_singular_node() helper
Message-ID<rSdaq-4y2-45@gated-at.bofh.it>
In reply to#1436214
Commit-ID:  15dba1e37b5cfd7fab9bc84e0f05f35c918f4eef
Gitweb:     http://git.kernel.org/tip/15dba1e37b5cfd7fab9bc84e0f05f35c918f4eef
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 4 Jul 2016 09:50:27 +0000
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 7 Jul 2016 10:35:07 +0200

hlist: Add hlist_is_singular_node() helper

Required to figure out whether the entry is the only one in the hlist.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: George Spelvin <linux@sciencehorizons.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160704094341.867631372@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/list.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/list.h b/include/linux/list.h
index 5356f4d..5183138 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -679,6 +679,16 @@ static inline bool hlist_fake(struct hlist_node *h)
 }
 
 /*
+ * Check whether the node is the only node of the head without
+ * accessing head:
+ */
+static inline bool
+hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h)
+{
+	return !n->next && n->pprev == &h->first;
+}
+
+/*
  * Move a list from one list head to another. Fixup the pprev
  * reference of the first entry if it exists.
  */

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web