lkml.org 
[lkml]   [2014]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 5/5] lockdep: pack subclass/trylock/read/check into a single argument

I tried the below but filed to see my vmlinux shrink, maybe I'm just not
building the right kernel, or otherwise GCC is stupid.

---
include/linux/lockdep.h | 33 ++++++++++++++++++++++++++++++---
kernel/locking/lockdep.c | 11 +++++++----
2 files changed, 32 insertions(+), 7 deletions(-)

--- a/include/linux/lockdep.h
+++ b/include/linux/lockdep.h
@@ -329,9 +329,31 @@ static inline int lockdep_match_key(stru
* 0: simple checks (freeing, held-at-exit-time, etc.)
* 1: full validation
*/
-extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
- int trylock, int read, int check,
- struct lockdep_map *nest_lock, unsigned long ip);
+struct lockdep_acquire_flags {
+ unsigned long subclass : 3;
+ unsigned long trylock : 1;
+ unsigned long read : 2;
+ unsigned long check : 1;
+};
+
+extern void do_lock_acquire(struct lockdep_map *lock,
+ struct lockdep_acquire_flags acqf,
+ struct lockdep_map *nest_lock,
+ unsigned long ip);
+
+static inline void lock_acquire(struct lockdep_map *lock,
+ unsigned int subclass, int trylock, int read, int check,
+ struct lockdep_map *nest_lock, unsigned long ip)
+{
+ struct lockdep_acquire_flags acqf = {
+ .subclass = subclass,
+ .trylock = trylock,
+ .read = read,
+ .check = check,
+ };
+
+ do_lock_acquire(lock, acqf, nest_lock, ip);
+}

extern void lock_release(struct lockdep_map *lock, int nested,
unsigned long ip);
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3583,10 +3583,13 @@ EXPORT_SYMBOL_GPL(lock_set_class);
* We are not always called with irqs disabled - do that here,
* and also avoid lockdep recursion:
*/
-void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
- int trylock, int read, int check,
- struct lockdep_map *nest_lock, unsigned long ip)
+void do_lock_acquire(struct lockdep_map *lock, struct lockdep_acquire_flags acqf,
+ struct lockdep_map *nest_lock, unsigned long ip)
{
+ unsigned int subclass = acqf.subclass;
+ unsigned int trylock = acqf.trylock;
+ unsigned int read = acqf.read;
+ unsigned int check = acqf.check;
unsigned long flags;

if (unlikely(current->lockdep_recursion))
@@ -3602,7 +3605,7 @@ void lock_acquire(struct lockdep_map *lo
current->lockdep_recursion = 0;
raw_local_irq_restore(flags);
}
-EXPORT_SYMBOL_GPL(lock_acquire);
+EXPORT_SYMBOL_GPL(do_lock_acquire);

void lock_release(struct lockdep_map *lock, int nested,
unsigned long ip)

\
 
 \ /
  Last update: 2014-01-21 16:01    [W:0.216 / U:1.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site