[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240902140532.2028-4-thunder.leizhen@huawei.com>
Date: Mon, 2 Sep 2024 22:05:30 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Andrew Morton <akpm@...ux-foundation.org>, Thomas Gleixner
<tglx@...utronix.de>, <linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH 3/5] debugobjects: Don't start fill if there are remaining nodes locally
If the conditions for starting fill are met, it means that all cores that
call fill() later are blocked until the first core completes the fill
operation. But obviously, for a core that has free nodes locally, it does
not need to be blocked. This is good in stress situations.
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
lib/debugobjects.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
index aba3e62a4315f51..fc8224f9f0eda8f 100644
--- a/lib/debugobjects.c
+++ b/lib/debugobjects.c
@@ -130,10 +130,15 @@ static void fill_pool(void)
gfp_t gfp = __GFP_HIGH | __GFP_NOWARN;
struct debug_obj *obj;
unsigned long flags;
+ struct debug_percpu_free *percpu_pool;
if (likely(READ_ONCE(obj_pool_free) >= debug_objects_pool_min_level))
return;
+ percpu_pool = this_cpu_ptr(&percpu_obj_pool);
+ if (likely(obj_cache) && percpu_pool->obj_free > 0)
+ return;
+
/*
* Reuse objs from the global free list; they will be reinitialized
* when allocating.
--
2.34.1
Powered by blists - more mailing lists