[PATCH] kill sigqueue->lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

--- 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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux