From: tip-bot for Jason Low <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: fweisbec@gmail.com, rostedt@goodmis.org, tglx@linutronix.de,
linux-kernel@vger.kernel.org, peterz@infradead.org,
paulmck@linux.vnet.ibm.com, jason.low2@hp.com, hpa@zytor.com,
oleg@redhat.com, dave@stgolabs.net, mingo@kernel.org,
linux@horizon.com
Subject: [tip:timers/core] posix_cpu_timer: Convert cputimer-> running to bool
Date: Thu, 15 Oct 2015 02:28:23 -0700 [thread overview]
Message-ID: <tip-d5c373eb5610686162ff50429f63f4c00c554799@git.kernel.org> (raw)
In-Reply-To: <1444849677-29330-4-git-send-email-jason.low2@hp.com>
Commit-ID: d5c373eb5610686162ff50429f63f4c00c554799
Gitweb: http://git.kernel.org/tip/d5c373eb5610686162ff50429f63f4c00c554799
Author: Jason Low <jason.low2@hp.com>
AuthorDate: Wed, 14 Oct 2015 12:07:55 -0700
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 15 Oct 2015 11:23:41 +0200
posix_cpu_timer: Convert cputimer->running to bool
In the next patch in this series, a new field 'checking_timer' will
be added to 'struct thread_group_cputimer'. Both this and the
existing 'running' integer field are just used as boolean values. To
save space in the structure, we can make both of these fields booleans.
This is a preparatory patch to convert the existing running integer
field to a boolean.
Suggested-by: George Spelvin <linux@horizon.com>
Signed-off-by: Jason Low <jason.low2@hp.com>
Reviewed: George Spelvin <linux@horizon.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: hideaki.kimura@hpe.com
Cc: terry.rudd@hpe.com
Cc: scott.norton@hpe.com
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1444849677-29330-4-git-send-email-jason.low2@hp.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/init_task.h | 2 +-
include/linux/sched.h | 6 +++---
kernel/fork.c | 2 +-
kernel/time/posix-cpu-timers.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index e38681f..c43b80f 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -59,7 +59,7 @@ extern struct fs_struct init_fs;
.rlim = INIT_RLIMITS, \
.cputimer = { \
.cputime_atomic = INIT_CPUTIME_ATOMIC, \
- .running = 0, \
+ .running = false, \
}, \
INIT_PREV_CPUTIME(sig) \
.cred_guard_mutex = \
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b7b9501..6c8504a 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -617,15 +617,15 @@ struct task_cputime_atomic {
/**
* struct thread_group_cputimer - thread group interval timer counts
* @cputime_atomic: atomic thread group interval timers.
- * @running: non-zero when there are timers running and
- * @cputime receives updates.
+ * @running: true when there are timers running and
+ * @cputime_atomic receives updates.
*
* This structure contains the version of task_cputime, above, that is
* used for thread group CPU timer calculations.
*/
struct thread_group_cputimer {
struct task_cputime_atomic cputime_atomic;
- int running;
+ bool running;
};
#include <linux/rwsem.h>
diff --git a/kernel/fork.c b/kernel/fork.c
index 2845623..6ac8942 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1101,7 +1101,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
if (cpu_limit != RLIM_INFINITY) {
sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit);
- sig->cputimer.running = 1;
+ sig->cputimer.running = true;
}
/* The timer lists. */
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 6f6e252..2d58153 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -249,7 +249,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
* but barriers are not required because update_gt_cputime()
* can handle concurrent updates.
*/
- WRITE_ONCE(cputimer->running, 1);
+ WRITE_ONCE(cputimer->running, true);
}
sample_cputime_atomic(times, &cputimer->cputime_atomic);
}
@@ -918,7 +918,7 @@ static inline void stop_process_timers(struct signal_struct *sig)
struct thread_group_cputimer *cputimer = &sig->cputimer;
/* Turn off cputimer->running. This is done without locking. */
- WRITE_ONCE(cputimer->running, 0);
+ WRITE_ONCE(cputimer->running, false);
}
static u32 onecputick;
next prev parent reply other threads:[~2015-10-15 9:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 19:07 [PATCH v2 0/4] timer: Improve itimers scalability Jason Low
2015-10-14 19:07 ` [PATCH v2 1/4] timer: Optimize fastpath_timer_check() Jason Low
2015-10-15 9:27 ` [tip:timers/core] posix_cpu_timer: Optimize fastpath_timer_check( ) tip-bot for Jason Low
2015-10-14 19:07 ` [PATCH v2 2/4] timer: Check thread timers only when there are active thread timers Jason Low
2015-10-15 9:28 ` [tip:timers/core] posix_cpu_timer: " tip-bot for Jason Low
2015-10-14 19:07 ` [PATCH v2 3/4] timer: Convert cputimer->running to bool Jason Low
2015-10-15 9:28 ` tip-bot for Jason Low [this message]
2015-10-14 19:07 ` [PATCH v2 4/4] timer: Reduce unnecessary sighand lock contention Jason Low
2015-10-15 9:28 ` [tip:timers/core] posix_cpu_timer: " tip-bot for Jason Low
2015-10-14 21:18 ` [PATCH v2 0/4] timer: Improve itimers scalability George Spelvin
2015-10-15 12:30 ` Frederic Weisbecker
2015-10-15 19:00 ` Jason Low
2015-10-15 8:47 ` Ingo Molnar
2015-10-15 19:01 ` Jason Low
2015-10-16 7:12 ` Ingo Molnar
2015-10-16 17:34 ` Jason Low
2015-10-16 17:46 ` Hideaki Kimura
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=tip-d5c373eb5610686162ff50429f63f4c00c554799@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dave@stgolabs.net \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jason.low2@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=linux@horizon.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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