locking: Introduce __cleanup() based infrastructure
Use __attribute__((__cleanup__(func))) to build: - simple auto-release pointers using __free() - 'classes' with constructor and destructor semantics for scope-based resource management. - lock guards based on the above classes. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230612093537.614161713%40infradead.org
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <linux/preempt.h>
|
||||
#include <linux/bottom_half.h>
|
||||
#include <linux/lockdep.h>
|
||||
#include <linux/cleanup.h>
|
||||
#include <asm/processor.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/context_tracking_irq.h>
|
||||
@@ -1095,4 +1096,6 @@ rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
|
||||
extern int rcu_expedited;
|
||||
extern int rcu_normal;
|
||||
|
||||
DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock())
|
||||
|
||||
#endif /* __LINUX_RCUPDATE_H */
|
||||
|
||||
Reference in New Issue
Block a user