lkml.org 
[lkml]   [2021]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 15/17] zsmalloc: Add zs_pin_lock
Date
Allow lockdep to track zsmalloc's pin bit spin lock.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/zsmalloc.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 9a7c91c14b84..9d89a1857901 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -874,6 +874,8 @@ static unsigned long obj_to_head(struct page *page, void *obj)
return *(unsigned long *)obj;
}

+static DEFINE_SPLIT_LOCK(zs_pin_lock);
+
static inline int testpin_tag(unsigned long handle)
{
return bit_spin_is_locked(HANDLE_PIN_BIT, (unsigned long *)handle);
@@ -881,17 +883,20 @@ static inline int testpin_tag(unsigned long handle)

static inline int trypin_tag(unsigned long handle)
{
- return bit_spin_trylock(HANDLE_PIN_BIT, (unsigned long *)handle);
+ return bit_spin_trylock(HANDLE_PIN_BIT, (unsigned long *)handle,
+ &zs_pin_lock);
}

static void pin_tag(unsigned long handle) __acquires(bitlock)
{
- bit_spin_lock(HANDLE_PIN_BIT, (unsigned long *)handle);
+ bit_spin_lock(HANDLE_PIN_BIT, (unsigned long *)handle,
+ &zs_pin_lock);
}

static void unpin_tag(unsigned long handle) __releases(bitlock)
{
- bit_spin_unlock(HANDLE_PIN_BIT, (unsigned long *)handle);
+ bit_spin_unlock(HANDLE_PIN_BIT, (unsigned long *)handle,
+ &zs_pin_lock);
}

static void reset_page(struct page *page)
--
2.30.2
\
 
 \ /
  Last update: 2021-04-09 05:02    [W:0.372 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site