[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1302031310-1765-5-git-send-email-matt@console-pimps.org>
Date: Tue, 5 Apr 2011 20:21:49 +0100
From: Matt Fleming <matt@...sole-pimps.org>
To: Tejun Heo <tj@...nel.org>, Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
"H. Peter Anvin" <hpa@...or.com>,
Matt Fleming <matt.fleming@...ux.intel.com>
Subject: [RFC][PATCH 4/5] signals: Introduce __dequeue_private_signal helper function
From: Matt Fleming <matt.fleming@...ux.intel.com>
To keep things symmetric with __dequeue_shared_signal() create a
__dequeue_private_signal() function which helps to hide the required
locking for accessing tsk->pending.
Signed-off-by: Matt Fleming <matt.fleming@...ux.intel.com>
---
kernel/signal.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index c67f27a..db0ce0e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -642,6 +642,18 @@ static int __dequeue_shared_signal(struct task_struct *tsk,
return signr;
}
+static int __dequeue_private_signal(struct task_struct *tsk,
+ sigset_t *mask, siginfo_t *info)
+{
+ int signr;
+
+ spin_lock_irq(&tsk->siglock);
+ signr = __dequeue_signal(&tsk->pending, mask, info);
+ spin_unlock_irq(&tsk->siglock);
+
+ return signr;
+}
+
/*
* Dequeue a signal and return the element to the caller, which is
* expected to free it.
@@ -665,11 +677,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
/* We only dequeue private signals from ourselves, we don't let
* signalfd steal them
*/
- if (!signr) {
- spin_lock(&tsk->siglock);
- signr = __dequeue_signal(&tsk->pending, mask, info);
- spin_unlock(&tsk->siglock);
- }
+ if (!signr)
+ signr = __dequeue_private_signal(tsk, mask, info);
recalc_sigpending();
if (!signr)
--
1.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists