@@ -57,13 +57,6 @@ void remove_wait_queue(struct wait_queue_head *wq_head, struct wait_queue_entry
57
57
}
58
58
EXPORT_SYMBOL (remove_wait_queue );
59
59
60
- /*
61
- * Scan threshold to break wait queue walk.
62
- * This allows a waker to take a break from holding the
63
- * wait queue lock during the wait queue walk.
64
- */
65
- #define WAITQUEUE_WALK_BREAK_CNT 64
66
-
67
60
/*
68
61
* The core wakeup function. Non-exclusive wakeups (nr_exclusive == 0) just
69
62
* wake everything up. If it's an exclusive wakeup (nr_exclusive == small +ve
@@ -78,21 +71,13 @@ EXPORT_SYMBOL(remove_wait_queue);
78
71
* zero in this (rare) case, and we handle it by continuing to scan the queue.
79
72
*/
80
73
static int __wake_up_common (struct wait_queue_head * wq_head , unsigned int mode ,
81
- int nr_exclusive , int wake_flags , void * key ,
82
- wait_queue_entry_t * bookmark )
74
+ int nr_exclusive , int wake_flags , void * key )
83
75
{
84
76
wait_queue_entry_t * curr , * next ;
85
- int cnt = 0 ;
86
77
87
78
lockdep_assert_held (& wq_head -> lock );
88
79
89
- if (bookmark && (bookmark -> flags & WQ_FLAG_BOOKMARK )) {
90
- curr = list_next_entry (bookmark , entry );
91
-
92
- list_del (& bookmark -> entry );
93
- bookmark -> flags = 0 ;
94
- } else
95
- curr = list_first_entry (& wq_head -> head , wait_queue_entry_t , entry );
80
+ curr = list_first_entry (& wq_head -> head , wait_queue_entry_t , entry );
96
81
97
82
if (& curr -> entry == & wq_head -> head )
98
83
return nr_exclusive ;
@@ -101,21 +86,11 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
101
86
unsigned flags = curr -> flags ;
102
87
int ret ;
103
88
104
- if (flags & WQ_FLAG_BOOKMARK )
105
- continue ;
106
-
107
89
ret = curr -> func (curr , mode , wake_flags , key );
108
90
if (ret < 0 )
109
91
break ;
110
92
if (ret && (flags & WQ_FLAG_EXCLUSIVE ) && !-- nr_exclusive )
111
93
break ;
112
-
113
- if (bookmark && (++ cnt > WAITQUEUE_WALK_BREAK_CNT ) &&
114
- (& next -> entry != & wq_head -> head )) {
115
- bookmark -> flags = WQ_FLAG_BOOKMARK ;
116
- list_add_tail (& bookmark -> entry , & next -> entry );
117
- break ;
118
- }
119
94
}
120
95
121
96
return nr_exclusive ;
@@ -125,20 +100,12 @@ static int __wake_up_common_lock(struct wait_queue_head *wq_head, unsigned int m
125
100
int nr_exclusive , int wake_flags , void * key )
126
101
{
127
102
unsigned long flags ;
128
- wait_queue_entry_t bookmark ;
129
- int remaining = nr_exclusive ;
103
+ int remaining ;
130
104
131
- bookmark .flags = 0 ;
132
- bookmark .private = NULL ;
133
- bookmark .func = NULL ;
134
- INIT_LIST_HEAD (& bookmark .entry );
135
-
136
- do {
137
- spin_lock_irqsave (& wq_head -> lock , flags );
138
- remaining = __wake_up_common (wq_head , mode , remaining ,
139
- wake_flags , key , & bookmark );
140
- spin_unlock_irqrestore (& wq_head -> lock , flags );
141
- } while (bookmark .flags & WQ_FLAG_BOOKMARK );
105
+ spin_lock_irqsave (& wq_head -> lock , flags );
106
+ remaining = __wake_up_common (wq_head , mode , nr_exclusive , wake_flags ,
107
+ key );
108
+ spin_unlock_irqrestore (& wq_head -> lock , flags );
142
109
143
110
return nr_exclusive - remaining ;
144
111
}
@@ -171,23 +138,16 @@ void __wake_up_on_current_cpu(struct wait_queue_head *wq_head, unsigned int mode
171
138
*/
172
139
void __wake_up_locked (struct wait_queue_head * wq_head , unsigned int mode , int nr )
173
140
{
174
- __wake_up_common (wq_head , mode , nr , 0 , NULL , NULL );
141
+ __wake_up_common (wq_head , mode , nr , 0 , NULL );
175
142
}
176
143
EXPORT_SYMBOL_GPL (__wake_up_locked );
177
144
178
145
void __wake_up_locked_key (struct wait_queue_head * wq_head , unsigned int mode , void * key )
179
146
{
180
- __wake_up_common (wq_head , mode , 1 , 0 , key , NULL );
147
+ __wake_up_common (wq_head , mode , 1 , 0 , key );
181
148
}
182
149
EXPORT_SYMBOL_GPL (__wake_up_locked_key );
183
150
184
- void __wake_up_locked_key_bookmark (struct wait_queue_head * wq_head ,
185
- unsigned int mode , void * key , wait_queue_entry_t * bookmark )
186
- {
187
- __wake_up_common (wq_head , mode , 1 , 0 , key , bookmark );
188
- }
189
- EXPORT_SYMBOL_GPL (__wake_up_locked_key_bookmark );
190
-
191
151
/**
192
152
* __wake_up_sync_key - wake up threads blocked on a waitqueue.
193
153
* @wq_head: the waitqueue
@@ -233,7 +193,7 @@ EXPORT_SYMBOL_GPL(__wake_up_sync_key);
233
193
void __wake_up_locked_sync_key (struct wait_queue_head * wq_head ,
234
194
unsigned int mode , void * key )
235
195
{
236
- __wake_up_common (wq_head , mode , 1 , WF_SYNC , key , NULL );
196
+ __wake_up_common (wq_head , mode , 1 , WF_SYNC , key );
237
197
}
238
198
EXPORT_SYMBOL_GPL (__wake_up_locked_sync_key );
239
199
0 commit comments