From: Andrey Vagin <avagin@openvz.org>
To: Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, stable@kernel.org,
Oleg Nesterov <oleg@tv-sign.ru>,
Pavel Emelyanov <xemul@openvz.org>,
Andrey Vagin <avagin@openvz.org>
Subject: [PATCH 1/2] posix_timer: separate timer_cleanup from timer_del
Date: Fri, 14 May 2010 17:28:50 +0400 [thread overview]
Message-ID: <1273843731-12595-1-git-send-email-avagin@openvz.org> (raw)
Signed-off-by: Andrey Vagin <avagin@openvz.org>
---
include/linux/posix-timers.h | 2 ++
kernel/posix-cpu-timers.c | 13 ++++++++++---
kernel/posix-timers.c | 4 ++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 4f71bf4..613ab27 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -78,6 +78,7 @@ struct k_clock {
int (*timer_set) (struct k_itimer * timr, int flags,
struct itimerspec * new_setting,
struct itimerspec * old_setting);
+ void (*timer_cleanup) (struct k_itimer * timr);
int (*timer_del) (struct k_itimer * timr);
#define TIMER_RETRY 1
void (*timer_get) (struct k_itimer * timr,
@@ -103,6 +104,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags,
long posix_cpu_nsleep_restart(struct restart_block *restart_block);
int posix_cpu_timer_set(struct k_itimer *timer, int flags,
struct itimerspec *new, struct itimerspec *old);
+void posix_cpu_timer_cleanup(struct k_itimer *timer);
int posix_cpu_timer_del(struct k_itimer *timer);
void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp);
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index bc7704b..7a57833 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -455,14 +455,21 @@ int posix_cpu_timer_del(struct k_itimer *timer)
spin_unlock(&p->sighand->siglock);
}
read_unlock(&tasklist_lock);
-
- if (!ret)
- put_task_struct(p);
}
+ if (!ret)
+ posix_cpu_timer_cleanup(timer);
+
return ret;
}
+void posix_cpu_timer_cleanup(struct k_itimer *timer)
+{
+ struct task_struct *p = timer->it.cpu.task;
+ if (likely(p != NULL))
+ put_task_struct(p);
+}
+
/*
* Clean out CPU timers still ticking when a thread exited. The task
* pointer is cleared, and the expiry time is replaced with the residual
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 00d1fda..1195668 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -197,6 +197,10 @@ static int common_timer_create(struct k_itimer *new_timer)
return 0;
}
+static inline void common_timer_cleanup(struct k_itimer *timer)
+{
+}
+
static int no_timer_create(struct k_itimer *new_timer)
{
return -EOPNOTSUPP;
--
1.6.6
next reply other threads:[~2010-05-14 13:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-14 13:28 Andrey Vagin [this message]
2010-05-14 13:28 ` [PATCH 2/2] posix_timer: clean up properly if anything fails after *_timer_create Andrey Vagin
2010-05-14 16:03 ` Oleg Nesterov
2010-05-14 17:18 ` Stanislaw Gruszka
2010-05-14 18:48 ` Oleg Nesterov
2010-05-15 14:17 ` Andrew Vagin
2010-05-14 16:01 ` [PATCH 1/2] posix_timer: separate timer_cleanup from timer_del Oleg Nesterov
2010-05-24 21:40 ` [stable] " Greg KH
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=1273843731-12595-1-git-send-email-avagin@openvz.org \
--to=avagin@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=stable@kernel.org \
--cc=tglx@linutronix.de \
--cc=xemul@openvz.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®