Skip to content

Commit 732375c

Browse files
Dima ZavinIngo Molnar
authored andcommitted
plist: Remove the need to supply locks to plist heads
This was legacy code brought over from the RT tree and is no longer necessary. Signed-off-by: Dima Zavin <dima@android.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Cc: Daniel Walker <dwalker@codeaurora.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Andi Kleen <andi@firstfloor.org> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Link: http://lkml.kernel.org/r/1310084879-10351-2-git-send-email-dima@android.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 8edbb83 commit 732375c

File tree

8 files changed

+14
-68
lines changed

8 files changed

+14
-68
lines changed

include/linux/plist.h

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,9 @@
7777

7878
#include <linux/kernel.h>
7979
#include <linux/list.h>
80-
#include <linux/spinlock_types.h>
8180

8281
struct plist_head {
8382
struct list_head node_list;
84-
#ifdef CONFIG_DEBUG_PI_LIST
85-
raw_spinlock_t *rawlock;
86-
spinlock_t *spinlock;
87-
#endif
8883
};
8984

9085
struct plist_node {
@@ -93,37 +88,13 @@ struct plist_node {
9388
struct list_head node_list;
9489
};
9590

96-
#ifdef CONFIG_DEBUG_PI_LIST
97-
# define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
98-
# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
99-
#else
100-
# define PLIST_HEAD_LOCK_INIT(_lock)
101-
# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
102-
#endif
103-
104-
#define _PLIST_HEAD_INIT(head) \
105-
.node_list = LIST_HEAD_INIT((head).node_list)
106-
10791
/**
10892
* PLIST_HEAD_INIT - static struct plist_head initializer
10993
* @head: struct plist_head variable name
110-
* @_lock: lock to initialize for this list
111-
*/
112-
#define PLIST_HEAD_INIT(head, _lock) \
113-
{ \
114-
_PLIST_HEAD_INIT(head), \
115-
PLIST_HEAD_LOCK_INIT(&(_lock)) \
116-
}
117-
118-
/**
119-
* PLIST_HEAD_INIT_RAW - static struct plist_head initializer
120-
* @head: struct plist_head variable name
121-
* @_lock: lock to initialize for this list
12294
*/
123-
#define PLIST_HEAD_INIT_RAW(head, _lock) \
95+
#define PLIST_HEAD_INIT(head) \
12496
{ \
125-
_PLIST_HEAD_INIT(head), \
126-
PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
97+
.node_list = LIST_HEAD_INIT((head).node_list) \
12798
}
12899

129100
/**
@@ -141,31 +112,11 @@ struct plist_node {
141112
/**
142113
* plist_head_init - dynamic struct plist_head initializer
143114
* @head: &struct plist_head pointer
144-
* @lock: spinlock protecting the list (debugging)
145115
*/
146116
static inline void
147-
plist_head_init(struct plist_head *head, spinlock_t *lock)
117+
plist_head_init(struct plist_head *head)
148118
{
149119
INIT_LIST_HEAD(&head->node_list);
150-
#ifdef CONFIG_DEBUG_PI_LIST
151-
head->spinlock = lock;
152-
head->rawlock = NULL;
153-
#endif
154-
}
155-
156-
/**
157-
* plist_head_init_raw - dynamic struct plist_head initializer
158-
* @head: &struct plist_head pointer
159-
* @lock: raw_spinlock protecting the list (debugging)
160-
*/
161-
static inline void
162-
plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
163-
{
164-
INIT_LIST_HEAD(&head->node_list);
165-
#ifdef CONFIG_DEBUG_PI_LIST
166-
head->rawlock = lock;
167-
head->spinlock = NULL;
168-
#endif
169120
}
170121

171122
/**

include/linux/rtmutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct hrtimer_sleeper;
6666

6767
#define __RT_MUTEX_INITIALIZER(mutexname) \
6868
{ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
69-
, .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \
69+
, .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \
7070
, .owner = NULL \
7171
__DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
7272

@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock);
100100

101101
#ifdef CONFIG_RT_MUTEXES
102102
# define INIT_RT_MUTEXES(tsk) \
103-
.pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \
103+
.pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \
104104
INIT_RT_MUTEX_DEBUG(tsk)
105105
#else
106106
# define INIT_RT_MUTEXES(tsk)

kernel/fork.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ static void rt_mutex_init_task(struct task_struct *p)
10131013
{
10141014
raw_spin_lock_init(&p->pi_lock);
10151015
#ifdef CONFIG_RT_MUTEXES
1016-
plist_head_init_raw(&p->pi_waiters, &p->pi_lock);
1016+
plist_head_init(&p->pi_waiters);
10171017
p->pi_blocked_on = NULL;
10181018
#endif
10191019
}

kernel/futex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ static int __init futex_init(void)
26972697
futex_cmpxchg_enabled = 1;
26982698

26992699
for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2700-
plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2700+
plist_head_init(&futex_queues[i].chain);
27012701
spin_lock_init(&futex_queues[i].lock);
27022702
}
27032703

kernel/pm_qos_params.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static DEFINE_SPINLOCK(pm_qos_lock);
7474
static struct pm_qos_object null_pm_qos;
7575
static BLOCKING_NOTIFIER_HEAD(cpu_dma_lat_notifier);
7676
static struct pm_qos_object cpu_dma_pm_qos = {
77-
.requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests, pm_qos_lock),
77+
.requests = PLIST_HEAD_INIT(cpu_dma_pm_qos.requests),
7878
.notifiers = &cpu_dma_lat_notifier,
7979
.name = "cpu_dma_latency",
8080
.target_value = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE,
@@ -84,7 +84,7 @@ static struct pm_qos_object cpu_dma_pm_qos = {
8484

8585
static BLOCKING_NOTIFIER_HEAD(network_lat_notifier);
8686
static struct pm_qos_object network_lat_pm_qos = {
87-
.requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests, pm_qos_lock),
87+
.requests = PLIST_HEAD_INIT(network_lat_pm_qos.requests),
8888
.notifiers = &network_lat_notifier,
8989
.name = "network_latency",
9090
.target_value = PM_QOS_NETWORK_LAT_DEFAULT_VALUE,
@@ -95,7 +95,7 @@ static struct pm_qos_object network_lat_pm_qos = {
9595

9696
static BLOCKING_NOTIFIER_HEAD(network_throughput_notifier);
9797
static struct pm_qos_object network_throughput_pm_qos = {
98-
.requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests, pm_qos_lock),
98+
.requests = PLIST_HEAD_INIT(network_throughput_pm_qos.requests),
9999
.notifiers = &network_throughput_notifier,
100100
.name = "network_throughput",
101101
.target_value = PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE,

kernel/rtmutex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ void __rt_mutex_init(struct rt_mutex *lock, const char *name)
890890
{
891891
lock->owner = NULL;
892892
raw_spin_lock_init(&lock->wait_lock);
893-
plist_head_init_raw(&lock->wait_list, &lock->wait_lock);
893+
plist_head_init(&lock->wait_list);
894894

895895
debug_rt_mutex_init(lock, name);
896896
}

kernel/sched.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7781,7 +7781,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq)
77817781
#ifdef CONFIG_SMP
77827782
rt_rq->rt_nr_migratory = 0;
77837783
rt_rq->overloaded = 0;
7784-
plist_head_init_raw(&rt_rq->pushable_tasks, &rq->lock);
7784+
plist_head_init(&rt_rq->pushable_tasks);
77857785
#endif
77867786

77877787
rt_rq->rt_time = 0;
@@ -7986,7 +7986,7 @@ void __init sched_init(void)
79867986
#endif
79877987

79887988
#ifdef CONFIG_RT_MUTEXES
7989-
plist_head_init_raw(&init_task.pi_waiters, &init_task.pi_lock);
7989+
plist_head_init(&init_task.pi_waiters);
79907990
#endif
79917991

79927992
/*

lib/plist.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ static void plist_check_list(struct list_head *top)
5656

5757
static void plist_check_head(struct plist_head *head)
5858
{
59-
WARN_ON(head != &test_head && !head->rawlock && !head->spinlock);
60-
if (head->rawlock)
61-
WARN_ON_SMP(!raw_spin_is_locked(head->rawlock));
62-
if (head->spinlock)
63-
WARN_ON_SMP(!spin_is_locked(head->spinlock));
6459
if (!plist_head_empty(head))
6560
plist_check_list(&plist_first(head)->prio_list);
6661
plist_check_list(&head->node_list);
@@ -180,7 +175,7 @@ static int __init plist_test(void)
180175
unsigned int r = local_clock();
181176

182177
printk(KERN_INFO "start plist test\n");
183-
plist_head_init(&test_head, NULL);
178+
plist_head_init(&test_head);
184179
for (i = 0; i < ARRAY_SIZE(test_node); i++)
185180
plist_node_init(test_node + i, 0);
186181

0 commit comments

Comments
 (0)