From: Chris Wright <chrisw@osdl.org>
To: akpm@osdl.org, torvalds@osdl.org
Cc: jim.houston@ccur.com, linux-kernel@vger.kernel.org
Subject: [PATCH] make __sigqueue_alloc() a general helper
Date: Thu, 21 Oct 2004 14:54:02 -0700 [thread overview]
Message-ID: <20041021145402.O2441@build.pdx.osdl.net> (raw)
Posix timers preallocate siqueue structures during timer creation
and keep them for reuse. This allocation happens in user context
with no locks held, however it's designated as an atomic allocation.
Loosen this restriction, and while we're at it let's do a bit of code
consolidation so signal sending uses same __sigqueue_alloc() helper.
Signed-off-by: Chris Wright <chrisw@osdl.org>
kernel/signal.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
===== kernel/signal.c 1.139 vs edited =====
--- 1.139/kernel/signal.c 2004-10-19 21:12:13 -07:00
+++ edited/kernel/signal.c 2004-10-21 13:46:54 -07:00
@@ -265,18 +265,18 @@
return sig;
}
-static struct sigqueue *__sigqueue_alloc(void)
+static inline struct sigqueue *__sigqueue_alloc(struct task_struct *t, int flags)
{
struct sigqueue *q = NULL;
- if (atomic_read(¤t->user->sigpending) <
- current->signal->rlim[RLIMIT_SIGPENDING].rlim_cur)
- q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
+ if (atomic_read(&t->user->sigpending) <
+ t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur)
+ q = kmem_cache_alloc(sigqueue_cachep, flags);
if (q) {
INIT_LIST_HEAD(&q->list);
q->flags = 0;
q->lock = NULL;
- q->user = get_uid(current->user);
+ q->user = get_uid(t->user);
atomic_inc(&q->user->sigpending);
}
return(q);
@@ -764,14 +764,8 @@
make sure at least one signal gets delivered and don't
pass on the info struct. */
- if (atomic_read(&t->user->sigpending) <
- t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur)
- q = kmem_cache_alloc(sigqueue_cachep, GFP_ATOMIC);
-
+ q = __sigqueue_alloc(t, GFP_ATOMIC);
if (q) {
- q->flags = 0;
- q->user = get_uid(t->user);
- atomic_inc(&q->user->sigpending);
list_add_tail(&q->list, &signals->list);
switch ((unsigned long) info) {
case 0:
@@ -1298,7 +1292,7 @@
{
struct sigqueue *q;
- if ((q = __sigqueue_alloc()))
+ if ((q = __sigqueue_alloc(current, GFP_KERNEL)))
q->flags |= SIGQUEUE_PREALLOC;
return(q);
}
reply other threads:[~2004-10-21 22:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041021145402.O2441@build.pdx.osdl.net \
--to=chrisw@osdl.org \
--cc=akpm@osdl.org \
--cc=jim.houston@ccur.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®