[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240821230539.168107-4-woodyzhang666@gmail.com>
Date: Thu, 22 Aug 2024 07:05:37 +0800
From: Woody Zhang <woodyzhang666@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Woody Zhang <woodyzhang666@...il.com>
Subject: [PATCH 3/5] list_bl: remove lock check in hlist_bl_set_first
This allows it to be used in situations when locking is not required,
e.g. in early initialization phase.
Signed-off-by: Woody Zhang <woodyzhang666@...il.com>
---
include/linux/list_bl.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 7ce411567fe5..d25c659f6635 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -63,10 +63,9 @@ static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
static inline void hlist_bl_set_first(struct hlist_bl_head *h,
struct hlist_bl_node *n)
{
- LIST_BL_BUG_ON((unsigned long)n & LIST_BL_LOCKMASK);
- LIST_BL_BUG_ON(((unsigned long)h->first & LIST_BL_LOCKMASK) !=
- LIST_BL_LOCKMASK);
- h->first = (struct hlist_bl_node *)((unsigned long)n | LIST_BL_LOCKMASK);
+ LIST_BL_BUG_ON((uintptr_t)n & LIST_BL_LOCKMASK);
+ h->first = (struct hlist_bl_node *)
+ ((uintptr_t)n | ((uintptr_t)h->first & LIST_BL_LOCKMASK));
}
static inline bool hlist_bl_empty(const struct hlist_bl_head *h)
--
2.45.2
Powered by blists - more mailing lists