Skip to content

Commit 627454c

Browse files
mjguzikbrauner
authored andcommitted
pid: drop irq disablement around pidmap_lock
It no longer serves any purpose now that the tasklist_lock -> pidmap_lock ordering got eliminated. Reviewed-by: Oleg Nesterov <[email protected]> Signed-off-by: Mateusz Guzik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: "Liam R. Howlett" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 7903f90 commit 627454c

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

kernel/pid.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,10 @@ static void delayed_put_pid(struct rcu_head *rhp)
115115
void free_pid(struct pid *pid)
116116
{
117117
int i;
118-
unsigned long flags;
119118

120119
lockdep_assert_not_held(&tasklist_lock);
121120

122-
spin_lock_irqsave(&pidmap_lock, flags);
121+
spin_lock(&pidmap_lock);
123122
for (i = 0; i <= pid->level; i++) {
124123
struct upid *upid = pid->numbers + i;
125124
struct pid_namespace *ns = upid->ns;
@@ -142,7 +141,7 @@ void free_pid(struct pid *pid)
142141
idr_remove(&ns->idr, upid->nr);
143142
}
144143
pidfs_remove_pid(pid);
145-
spin_unlock_irqrestore(&pidmap_lock, flags);
144+
spin_unlock(&pidmap_lock);
146145

147146
call_rcu(&pid->rcu, delayed_put_pid);
148147
}
@@ -210,7 +209,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
210209
}
211210

212211
idr_preload(GFP_KERNEL);
213-
spin_lock_irq(&pidmap_lock);
212+
spin_lock(&pidmap_lock);
214213

215214
if (tid) {
216215
nr = idr_alloc(&tmp->idr, NULL, tid,
@@ -237,7 +236,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
237236
nr = idr_alloc_cyclic(&tmp->idr, NULL, pid_min,
238237
pid_max, GFP_ATOMIC);
239238
}
240-
spin_unlock_irq(&pidmap_lock);
239+
spin_unlock(&pidmap_lock);
241240
idr_preload_end();
242241

243242
if (nr < 0) {
@@ -271,7 +270,7 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
271270

272271
upid = pid->numbers + ns->level;
273272
idr_preload(GFP_KERNEL);
274-
spin_lock_irq(&pidmap_lock);
273+
spin_lock(&pidmap_lock);
275274
if (!(ns->pid_allocated & PIDNS_ADDING))
276275
goto out_unlock;
277276
pidfs_add_pid(pid);
@@ -280,18 +279,18 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
280279
idr_replace(&upid->ns->idr, pid, upid->nr);
281280
upid->ns->pid_allocated++;
282281
}
283-
spin_unlock_irq(&pidmap_lock);
282+
spin_unlock(&pidmap_lock);
284283
idr_preload_end();
285284

286285
return pid;
287286

288287
out_unlock:
289-
spin_unlock_irq(&pidmap_lock);
288+
spin_unlock(&pidmap_lock);
290289
idr_preload_end();
291290
put_pid_ns(ns);
292291

293292
out_free:
294-
spin_lock_irq(&pidmap_lock);
293+
spin_lock(&pidmap_lock);
295294
while (++i <= ns->level) {
296295
upid = pid->numbers + i;
297296
idr_remove(&upid->ns->idr, upid->nr);
@@ -301,17 +300,17 @@ struct pid *alloc_pid(struct pid_namespace *ns, pid_t *set_tid,
301300
if (ns->pid_allocated == PIDNS_ADDING)
302301
idr_set_cursor(&ns->idr, 0);
303302

304-
spin_unlock_irq(&pidmap_lock);
303+
spin_unlock(&pidmap_lock);
305304

306305
kmem_cache_free(ns->pid_cachep, pid);
307306
return ERR_PTR(retval);
308307
}
309308

310309
void disable_pid_allocation(struct pid_namespace *ns)
311310
{
312-
spin_lock_irq(&pidmap_lock);
311+
spin_lock(&pidmap_lock);
313312
ns->pid_allocated &= ~PIDNS_ADDING;
314-
spin_unlock_irq(&pidmap_lock);
313+
spin_unlock(&pidmap_lock);
315314
}
316315

317316
struct pid *find_pid_ns(int nr, struct pid_namespace *ns)

0 commit comments

Comments
 (0)