Commit d5c373eb authored by Jason Low's avatar Jason Low Committed by Thomas Gleixner

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: default avatarGeorge Spelvin <linux@horizon.com>
Signed-off-by: default avatarJason 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.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 934715a1
...@@ -59,7 +59,7 @@ extern struct fs_struct init_fs; ...@@ -59,7 +59,7 @@ extern struct fs_struct init_fs;
.rlim = INIT_RLIMITS, \ .rlim = INIT_RLIMITS, \
.cputimer = { \ .cputimer = { \
.cputime_atomic = INIT_CPUTIME_ATOMIC, \ .cputime_atomic = INIT_CPUTIME_ATOMIC, \
.running = 0, \ .running = false, \
}, \ }, \
INIT_PREV_CPUTIME(sig) \ INIT_PREV_CPUTIME(sig) \
.cred_guard_mutex = \ .cred_guard_mutex = \
......
...@@ -617,15 +617,15 @@ struct task_cputime_atomic { ...@@ -617,15 +617,15 @@ struct task_cputime_atomic {
/** /**
* struct thread_group_cputimer - thread group interval timer counts * struct thread_group_cputimer - thread group interval timer counts
* @cputime_atomic: atomic thread group interval timers. * @cputime_atomic: atomic thread group interval timers.
* @running: non-zero when there are timers running and * @running: true when there are timers running and
* @cputime receives updates. * @cputime_atomic receives updates.
* *
* This structure contains the version of task_cputime, above, that is * This structure contains the version of task_cputime, above, that is
* used for thread group CPU timer calculations. * used for thread group CPU timer calculations.
*/ */
struct thread_group_cputimer { struct thread_group_cputimer {
struct task_cputime_atomic cputime_atomic; struct task_cputime_atomic cputime_atomic;
int running; bool running;
}; };
#include <linux/rwsem.h> #include <linux/rwsem.h>
......
...@@ -1101,7 +1101,7 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) ...@@ -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); cpu_limit = READ_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
if (cpu_limit != RLIM_INFINITY) { if (cpu_limit != RLIM_INFINITY) {
sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit); sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit);
sig->cputimer.running = 1; sig->cputimer.running = true;
} }
/* The timer lists. */ /* The timer lists. */
......
...@@ -249,7 +249,7 @@ void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times) ...@@ -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() * but barriers are not required because update_gt_cputime()
* can handle concurrent updates. * can handle concurrent updates.
*/ */
WRITE_ONCE(cputimer->running, 1); WRITE_ONCE(cputimer->running, true);
} }
sample_cputime_atomic(times, &cputimer->cputime_atomic); sample_cputime_atomic(times, &cputimer->cputime_atomic);
} }
...@@ -918,7 +918,7 @@ static inline void stop_process_timers(struct signal_struct *sig) ...@@ -918,7 +918,7 @@ static inline void stop_process_timers(struct signal_struct *sig)
struct thread_group_cputimer *cputimer = &sig->cputimer; struct thread_group_cputimer *cputimer = &sig->cputimer;
/* Turn off cputimer->running. This is done without locking. */ /* Turn off cputimer->running. This is done without locking. */
WRITE_ONCE(cputimer->running, 0); WRITE_ONCE(cputimer->running, false);
} }
static u32 onecputick; static u32 onecputick;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment