linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: <linux-kernel@vger.kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>, Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 3/5] posix-cpu-timers: Pass the task into arm_timer
Date: Fri, 28 Feb 2020 11:09:46 -0600	[thread overview]
Message-ID: <8736auvdt1.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <87k146vdw3.fsf@x220.int.ebiederm.org> (Eric W. Biederman's message of "Fri, 28 Feb 2020 11:07:56 -0600")


We have already had to compute the task to take siglock before
calling arm_timer.  So pass the benefit of that labor into arm_timer.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
 kernel/time/posix-cpu-timers.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 3b27710f9505..dbbfa88881a3 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -482,12 +482,11 @@ void posix_cpu_timers_exit_group(struct task_struct *tsk)
  * Insert the timer on the appropriate list before any timers that
  * expire later.  This must be called with the sighand lock held.
  */
-static void arm_timer(struct k_itimer *timer)
+static void arm_timer(struct k_itimer *timer, struct task_struct *p)
 {
 	int clkidx = CPUCLOCK_WHICH(timer->it_clock);
 	struct cpu_timer *ctmr = &timer->it.cpu;
 	u64 newexp = cpu_timer_getexpires(ctmr);
-	struct task_struct *p = ctmr->task;
 	struct posix_cputimer_base *base;
 
 	if (CPUCLOCK_PERTHREAD(timer->it_clock))
@@ -660,7 +659,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
 	 */
 	cpu_timer_setexpires(ctmr, new_expires);
 	if (new_expires != 0 && val < new_expires) {
-		arm_timer(timer);
+		arm_timer(timer, p);
 	}
 
 	unlock_task_sighand(p, &flags);
@@ -981,7 +980,7 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
 	/*
 	 * Now re-arm for the new expiry time.
 	 */
-	arm_timer(timer);
+	arm_timer(timer, p);
 	unlock_task_sighand(p, &flags);
 }
 
-- 
2.25.0


  parent reply	other threads:[~2020-02-28 17:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 17:07 [PATCH 0/5] posix-cpu-timers: Graceful handling of reaped processes Eric W. Biederman
2020-02-28 17:08 ` [PATCH 1/5] posix-cpu-timers: cpu_clock_sample_group no longer needs siglock Eric W. Biederman
2020-03-01 10:27   ` [tip: timers/core] posix-cpu-timers: cpu_clock_sample_group() " tip-bot2 for Eric W. Biederman
2020-02-28 17:09 ` [PATCH 2/5] posix-cpu-timers: Remove unnecessary locking around cpu_clock_sample_group Eric W. Biederman
2020-03-01 10:27   ` [tip: timers/core] " tip-bot2 for Eric W. Biederman
2020-02-28 17:09 ` Eric W. Biederman [this message]
2020-03-01 10:27   ` [tip: timers/core] posix-cpu-timers: Pass the task into arm_timer() tip-bot2 for Eric W. Biederman
2020-02-28 17:11 ` [PATCH 4/5] posix-cpu-timers: Store a reference to a pid not a task Eric W. Biederman
2020-03-01 10:27   ` [tip: timers/core] " tip-bot2 for Eric W. Biederman
2020-03-04  8:57   ` tip-bot2 for Eric W. Biederman
2020-02-28 17:15 ` [PATCH 5/5] posix-cpu-timers: Stop disabling timers on mt-exec Eric W. Biederman
2020-03-01 10:27   ` [tip: timers/core] " tip-bot2 for Eric W. Biederman
2020-03-04  8:57   ` tip-bot2 for Eric W. Biederman

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=8736auvdt1.fsf@x220.int.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).