mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kill sigqueue->lock
@ 2005-09-25 14:07 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2005-09-25 14:07 UTC (permalink / raw)
  To: linux-kernel; +Cc: Roland McGrath, George Anzinger, Andrew Morton

This lock used in sigqueue_free(), but it is always equal to
current->sighand->siglock, so we don't need to keep it in the
struct sigqueue.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- 2.6.14-rc2/include/linux/signal.h~5_SILOCK	2005-06-18 17:42:16.000000000 +0400
+++ 2.6.14-rc2/include/linux/signal.h	2005-09-25 21:36:10.000000000 +0400
@@ -25,7 +25,6 @@
 
 struct sigqueue {
 	struct list_head list;
-	spinlock_t *lock;
 	int flags;
 	siginfo_t info;
 	struct user_struct *user;
--- 2.6.14-rc2/kernel/signal.c~5_SILOCK	2005-09-24 21:25:48.000000000 +0400
+++ 2.6.14-rc2/kernel/signal.c	2005-09-25 21:37:01.000000000 +0400
@@ -277,7 +277,6 @@ static struct sigqueue *__sigqueue_alloc
 	} else {
 		INIT_LIST_HEAD(&q->list);
 		q->flags = 0;
-		q->lock = NULL;
 		q->user = get_uid(t->user);
 	}
 	return(q);
@@ -1332,11 +1331,12 @@ void sigqueue_free(struct sigqueue *q)
 	 * pending queue.
 	 */
 	if (unlikely(!list_empty(&q->list))) {
-		read_lock(&tasklist_lock);  
-		spin_lock_irqsave(q->lock, flags);
+		spinlock_t *lock = &current->sighand->siglock;
+		read_lock(&tasklist_lock);
+		spin_lock_irqsave(lock, flags);
 		if (!list_empty(&q->list))
 			list_del_init(&q->list);
-		spin_unlock_irqrestore(q->lock, flags);
+		spin_unlock_irqrestore(lock, flags);
 		read_unlock(&tasklist_lock);
 	}
 	q->flags &= ~SIGQUEUE_PREALLOC;
@@ -1367,7 +1367,6 @@ send_sigqueue(int sig, struct sigqueue *
 		goto out;
 	}
 
-	q->lock = &p->sighand->siglock;
 	list_add_tail(&q->list, &p->pending.list);
 	sigaddset(&p->pending.signal, sig);
 	if (!sigismember(&p->blocked, sig))
@@ -1410,7 +1409,6 @@ send_group_sigqueue(int sig, struct sigq
 	 * We always use the shared queue for process-wide signals,
 	 * to avoid several races.
 	 */
-	q->lock = &p->sighand->siglock;
 	list_add_tail(&q->list, &p->signal->shared_pending.list);
 	sigaddset(&p->signal->shared_pending.signal, sig);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-09-25 13:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-25 14:07 [PATCH] kill sigqueue->lock Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®