Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247092

[PATCH v2 3/4] timer: Convert cputimer->running to bool

From Jason Low <jason.low2@hp.com>
Newsgroups linux.kernel
Subject [PATCH v2 3/4] timer: Convert cputimer->running to bool
Date 2015-10-14 21:10 +0200
Message-ID <qjzB0-7Ge-27@gated-at.bofh.it> (permalink)
References <qjzAZ-7Ge-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 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 23ca455..35a9c46 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -623,15 +623,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 83dea82..fe3f371 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;
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] timer: Improve itimers scalability Jason Low <jason.low2@hp.com> - 2015-10-14 21:10 +0200
  [PATCH v2 3/4] timer: Convert cputimer->running to bool Jason Low <jason.low2@hp.com> - 2015-10-14 21:10 +0200
    [tip:timers/core] posix_cpu_timer: Convert cputimer->  running to bool tip-bot for Jason Low <tipbot@zytor.com> - 2015-10-15 11:30 +0200
  Re: [PATCH v2 0/4] timer: Improve itimers scalability "George Spelvin" <linux@horizon.com> - 2015-10-14 23:20 +0200
    Re: [PATCH v2 0/4] timer: Improve itimers scalability Frederic Weisbecker <fweisbec@gmail.com> - 2015-10-15 14:40 +0200
    Re: [PATCH v2 0/4] timer: Improve itimers scalability Jason Low <jason.low@hpe.com> - 2015-10-15 21:10 +0200
  Re: [PATCH v2 0/4] timer: Improve itimers scalability Ingo Molnar <mingo@kernel.org> - 2015-10-15 10:50 +0200
    Re: [PATCH v2 0/4] timer: Improve itimers scalability Jason Low <jason.low@hpe.com> - 2015-10-15 21:10 +0200
      Re: [PATCH v2 0/4] timer: Improve itimers scalability Ingo Molnar <mingo@kernel.org> - 2015-10-16 09:20 +0200
        Re: [PATCH v2 0/4] timer: Improve itimers scalability Jason Low <jason.low@hpe.com> - 2015-10-16 19:40 +0200
          Re: [PATCH v2 0/4] timer: Improve itimers scalability Hideaki Kimura <hideaki.kimura@hpe.com> - 2015-10-16 20:10 +0200

csiph-web