lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20231025053133.343923-1-wuqiang.matt@bytedance.com>
Date:   Wed, 25 Oct 2023 13:31:33 +0800
From:   "wuqiang.matt" <wuqiang.matt@...edance.com>
To:     linux-trace-kernel@...r.kernel.org, mhiramat@...nel.org,
        davem@...emloft.net, anil.s.keshavamurthy@...el.com,
        naveen.n.rao@...ux.ibm.com, rostedt@...dmis.org,
        peterz@...radead.org, akpm@...ux-foundation.org,
        sander@...nheule.net, ebiggers@...gle.com,
        dan.j.williams@...el.com, jpoimboe@...nel.org
Cc:     linux-kernel@...r.kernel.org, lkp@...el.com, mattwu@....com,
        "wuqiang.matt" <wuqiang.matt@...edance.com>
Subject: [PATCH] lib,kprobes: objpool_try_add_slot merged into objpool_push

After several rounds of objpool improvements the existence
of inline function objpool_try_add_slot is not appropriate
any more:
1) push can only happen on local cpu node, the cpu param of
   objpool_try_add_slot is misleading
2) objpool_push is only a wrapper of objpool_try_add_slot,
   with the original loop of all cpu nodes removed

Signed-off-by: wuqiang.matt <wuqiang.matt@...edance.com>
---
 lib/objpool.c | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/lib/objpool.c b/lib/objpool.c
index a032701beccb..7474a3a60cad 100644
--- a/lib/objpool.c
+++ b/lib/objpool.c
@@ -152,13 +152,17 @@ int objpool_init(struct objpool_head *pool, int nr_objs, int object_size,
 }
 EXPORT_SYMBOL_GPL(objpool_init);
 
-/* adding object to slot, abort if the slot was already full */
-static inline int
-objpool_try_add_slot(void *obj, struct objpool_head *pool, int cpu)
+/* reclaim an object to object pool */
+int objpool_push(void *obj, struct objpool_head *pool)
 {
-	struct objpool_slot *slot = pool->cpu_slots[cpu];
+	struct objpool_slot *slot;
 	uint32_t head, tail;
+	unsigned long flags;
+
+	/* disable local irq to avoid preemption & interruption */
+	raw_local_irq_save(flags);
 
+	slot = pool->cpu_slots[raw_smp_processor_id()];
 	/* loading tail and head as a local snapshot, tail first */
 	tail = READ_ONCE(slot->tail);
 
@@ -173,21 +177,9 @@ objpool_try_add_slot(void *obj, struct objpool_head *pool, int cpu)
 	/* update sequence to make this obj available for pop() */
 	smp_store_release(&slot->last, tail + 1);
 
-	return 0;
-}
-
-/* reclaim an object to object pool */
-int objpool_push(void *obj, struct objpool_head *pool)
-{
-	unsigned long flags;
-	int rc;
-
-	/* disable local irq to avoid preemption & interruption */
-	raw_local_irq_save(flags);
-	rc = objpool_try_add_slot(obj, pool, raw_smp_processor_id());
 	raw_local_irq_restore(flags);
 
-	return rc;
+	return 0;
 }
 EXPORT_SYMBOL_GPL(objpool_push);
 
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ