itimers: merge ITIMER_VIRT and ITIMER_PROF common code
Subsystems (3)
PATCH 1/4 itimers: merge ITIMER_VIRT and ITIMER_PROF common code
Both cpu itimers have same data flow in the few places, this patch make unification of code related with VIRT and PROF itimers.
Signed-off-by Stanislaw Gruszka <[email protected]>
---
Compared to previous patch here we using CPUCLOCK_PROF/VIRT for indexing array in kernel/fork.c
include/linux/sched.h | 14 ++++- kernel/fork.c | 9 ++- kernel/itimer.c | 146 +++++++++++++++++++++------------------------ kernel/posix-cpu-timers.c | 98 ++++++++++++++---------------- 4 files changed, 130 insertions(+), 137 deletions(-)
include/linux/sched.h +11 -3
@@ -454,6 +454,11 @@ struct pacct_struct {unsigned long ac_minflt, ac_majflt; }; +struct cpu_itimer { +cputime_t expires; +cputime_t incr; +}; +/** * struct task_cputime - collected CPU time counts * @utime: time spent in user mode, in &cputime_t units
@@ -539,9 +544,12 @@ struct signal_struct {struct pid *leader_pid;ktime_t it_real_incr; -/* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */ -cputime_t it_prof_expires, it_virt_expires; -cputime_t it_prof_incr, it_virt_incr; +/* +* ITIMER_PROF and ITIMER_VIRTUAL timers for the process, we use +* CPUCLOCK_PROF and CPUCLOCK_VIRT for indexing array as these +* values are defined to 0 and 1 respectively +*/ +struct cpu_itimer it[2 ];/* * Thread group totals for process CPU timers.
kernel/fork.c +5 -4
@@ -63,6 +63,7 @@#include <linux/fs_struct.h> #include <trace/sched.h> #include <linux/magic.h> +#include <linux/posix-timers.h> #include <asm/pgtable.h> #include <asm/pgalloc.h>
@@ -790,10 +791,10 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)thread_group_cputime_init (sig);/* Expiration times and increments. */ - sig->it_virt_expires = cputime_zero; - sig->it_virt_incr = cputime_zero; - sig->it_prof_expires = cputime_zero; - sig->it_prof_incr = cputime_zero; + sig->it[CPUCLOCK_PROF ].expires = cputime_zero; + sig->it[CPUCLOCK_PROF ].incr = cputime_zero; + sig->it[CPUCLOCK_VIRT ].expires = cputime_zero; + sig->it[CPUCLOCK_VIRT ].incr = cputime_zero;/* Cached expiration times. */ sig->cputime_expires.prof_exp = cputime_zero;
kernel/itimer.c +68 -78
183 lines not on this page · raw message
kernel/posix-cpu-timers.c +46 -52
147 lines not on this page · raw message
Signature · 1 line
1.5.5.6
Little note, its not a resend, so resend 5 gives the wrong impression. Its a new version, the regular way would be to write something like:
[PATCH 0/4] itimer rework -v5
[PATCH 1/4] ...
Where you use the 0th email to indicate what the patch series is about, and what got changed since -v4 etc..