Commit 462e1e1bc879d10d7c2ce96a1b1001edaaa815ba

Authored by Lai Jiangshan
Committed by Al Viro
1 parent 614c321f4b

lglock: remove unused DEFINE_LGLOCK_LOCKDEP()

struct lglocks use their own lock_key/lock_dep_map which are defined in
struct lglock.  DEFINE_LGLOCK_LOCKDEP() is unused, so remove it and save a
small piece of memory.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 0 additions and 9 deletions Inline Diff

include/linux/lglock.h
1 /* 1 /*
2 * Specialised local-global spinlock. Can only be declared as global variables 2 * Specialised local-global spinlock. Can only be declared as global variables
3 * to avoid overhead and keep things simple (and we don't want to start using 3 * to avoid overhead and keep things simple (and we don't want to start using
4 * these inside dynamically allocated structures). 4 * these inside dynamically allocated structures).
5 * 5 *
6 * "local/global locks" (lglocks) can be used to: 6 * "local/global locks" (lglocks) can be used to:
7 * 7 *
8 * - Provide fast exclusive access to per-CPU data, with exclusive access to 8 * - Provide fast exclusive access to per-CPU data, with exclusive access to
9 * another CPU's data allowed but possibly subject to contention, and to 9 * another CPU's data allowed but possibly subject to contention, and to
10 * provide very slow exclusive access to all per-CPU data. 10 * provide very slow exclusive access to all per-CPU data.
11 * - Or to provide very fast and scalable read serialisation, and to provide 11 * - Or to provide very fast and scalable read serialisation, and to provide
12 * very slow exclusive serialisation of data (not necessarily per-CPU data). 12 * very slow exclusive serialisation of data (not necessarily per-CPU data).
13 * 13 *
14 * Brlocks are also implemented as a short-hand notation for the latter use 14 * Brlocks are also implemented as a short-hand notation for the latter use
15 * case. 15 * case.
16 * 16 *
17 * Copyright 2009, 2010, Nick Piggin, Novell Inc. 17 * Copyright 2009, 2010, Nick Piggin, Novell Inc.
18 */ 18 */
19 #ifndef __LINUX_LGLOCK_H 19 #ifndef __LINUX_LGLOCK_H
20 #define __LINUX_LGLOCK_H 20 #define __LINUX_LGLOCK_H
21 21
22 #include <linux/spinlock.h> 22 #include <linux/spinlock.h>
23 #include <linux/lockdep.h> 23 #include <linux/lockdep.h>
24 #include <linux/percpu.h> 24 #include <linux/percpu.h>
25 #include <linux/cpu.h> 25 #include <linux/cpu.h>
26 #include <linux/notifier.h> 26 #include <linux/notifier.h>
27 27
28 /* can make br locks by using local lock for read side, global lock for write */ 28 /* can make br locks by using local lock for read side, global lock for write */
29 #define br_lock_init(name) lg_lock_init(name, #name) 29 #define br_lock_init(name) lg_lock_init(name, #name)
30 #define br_read_lock(name) lg_local_lock(name) 30 #define br_read_lock(name) lg_local_lock(name)
31 #define br_read_unlock(name) lg_local_unlock(name) 31 #define br_read_unlock(name) lg_local_unlock(name)
32 #define br_write_lock(name) lg_global_lock(name) 32 #define br_write_lock(name) lg_global_lock(name)
33 #define br_write_unlock(name) lg_global_unlock(name) 33 #define br_write_unlock(name) lg_global_unlock(name)
34 34
35 #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) 35 #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
36 36
37 #ifdef CONFIG_DEBUG_LOCK_ALLOC 37 #ifdef CONFIG_DEBUG_LOCK_ALLOC
38 #define LOCKDEP_INIT_MAP lockdep_init_map 38 #define LOCKDEP_INIT_MAP lockdep_init_map
39
40 #define DEFINE_LGLOCK_LOCKDEP(name) \
41 struct lock_class_key name##_lock_key; \
42 struct lockdep_map name##_lock_dep_map; \
43 EXPORT_SYMBOL(name##_lock_dep_map)
44
45 #else 39 #else
46 #define LOCKDEP_INIT_MAP(a, b, c, d) 40 #define LOCKDEP_INIT_MAP(a, b, c, d)
47
48 #define DEFINE_LGLOCK_LOCKDEP(name)
49 #endif 41 #endif
50 42
51 struct lglock { 43 struct lglock {
52 arch_spinlock_t __percpu *lock; 44 arch_spinlock_t __percpu *lock;
53 #ifdef CONFIG_DEBUG_LOCK_ALLOC 45 #ifdef CONFIG_DEBUG_LOCK_ALLOC
54 struct lock_class_key lock_key; 46 struct lock_class_key lock_key;
55 struct lockdep_map lock_dep_map; 47 struct lockdep_map lock_dep_map;
56 #endif 48 #endif
57 }; 49 };
58 50
59 #define DEFINE_LGLOCK(name) \ 51 #define DEFINE_LGLOCK(name) \
60 DEFINE_LGLOCK_LOCKDEP(name); \
61 DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \ 52 DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \
62 = __ARCH_SPIN_LOCK_UNLOCKED; \ 53 = __ARCH_SPIN_LOCK_UNLOCKED; \
63 struct lglock name = { .lock = &name ## _lock } 54 struct lglock name = { .lock = &name ## _lock }
64 55
65 void lg_lock_init(struct lglock *lg, char *name); 56 void lg_lock_init(struct lglock *lg, char *name);
66 void lg_local_lock(struct lglock *lg); 57 void lg_local_lock(struct lglock *lg);
67 void lg_local_unlock(struct lglock *lg); 58 void lg_local_unlock(struct lglock *lg);
68 void lg_local_lock_cpu(struct lglock *lg, int cpu); 59 void lg_local_lock_cpu(struct lglock *lg, int cpu);
69 void lg_local_unlock_cpu(struct lglock *lg, int cpu); 60 void lg_local_unlock_cpu(struct lglock *lg, int cpu);
70 void lg_global_lock(struct lglock *lg); 61 void lg_global_lock(struct lglock *lg);
71 void lg_global_unlock(struct lglock *lg); 62 void lg_global_unlock(struct lglock *lg);
72 63
73 #endif 64 #endif
74 65