cputime patches for 2.6.29 take 2
Hi Linus,
I fixed the merge conflicts of the cputime branch with the latest upstream git and added a bug fix to "improve idle cputime accounting". The story is the same, second try:
Please pull from 'cputime' branch of
git://git390.osdl.marist.edu/pub/scm/linux-2.6.git cputime
to receive the following updates:
Martin Schwidefsky (6):
fix scaled & unscaled cputime accounting idle cputime accounting
improve precision of process accounting. improve precision of idle time detection. improve idle cputime accounting
fast vdso implementation for CLOCK_THREAD_CPUTIME_ID
arch/ia64/kernel/time.c | 18 +- arch/powerpc/kernel/process.c | 1 + arch/powerpc/kernel/time.c | 18 +- arch/s390/include/asm/cpu.h | 7 +- arch/s390/include/asm/cputime.h | 42 ++-- arch/s390/include/asm/lowcore.h | 49 ++-- arch/s390/include/asm/system.h | 4 +- arch/s390/include/asm/thread_info.h | 2 + arch/s390/include/asm/timer.h | 16 +- arch/s390/include/asm/vdso.h | 15 +- arch/s390/kernel/asm-offsets.c | 5 + arch/s390/kernel/entry.S | 5 +- arch/s390/kernel/entry64.S | 50 ++-- arch/s390/kernel/head64.S | 2 + arch/s390/kernel/process.c | 43 +--- arch/s390/kernel/s390_ext.c | 2 +- arch/s390/kernel/setup.c | 2 + arch/s390/kernel/smp.c | 34 ++- arch/s390/kernel/vdso.c | 123 ++++++++- arch/s390/kernel/vdso64/clock_getres.S | 5 + arch/s390/kernel/vdso64/clock_gettime.S | 39 +++- arch/s390/kernel/vtime.c | 486 +++++++++++++++++-------------- arch/x86/xen/time.c | 10 +- drivers/s390/cio/cio.c | 2 +- drivers/s390/s390mach.c | 3 + include/linux/kernel_stat.h | 13 +- include/linux/sched.h | 1 - kernel/sched.c | 115 +++++--- kernel/time/tick-sched.c | 12 +- kernel/timer.c | 15 - 30 files changed, 683 insertions(+), 456 deletions(-)
arch/ia64/kernel/time.c +10 -8
@@ -93,13 +93,14 @@ void ia64_account_on_switch(struct task_struct *prev, struct task_struct *next) now =ia64_get_itc (); delta_stime =cycle_to_cputime (pi->ac_stime + (now - pi->ac_stamp)); -account_system_time (prev,0 , delta_stime); -account_system_time_scaled (prev, delta_stime); +if (idle_task (smp_processor_id ()) != prev) +account_system_time (prev,0 , delta_stime, delta_stime); +else +account_idle_time (delta_stime);if (pi->ac_utime) { delta_utime =cycle_to_cputime (pi->ac_utime); -account_user_time (prev, delta_utime); -account_user_time_scaled (prev, delta_utime); +account_user_time (prev, delta_utime, delta_utime); } pi->ac_stamp = ni->ac_stamp = now;
@@ -122,8 +123,10 @@ void account_system_vtime(struct task_struct *tsk) now =ia64_get_itc (); delta_stime =cycle_to_cputime (ti->ac_stime + (now - ti->ac_stamp)); -account_system_time (tsk,0 , delta_stime); -account_system_time_scaled (tsk, delta_stime); +if (irq_count () ||idle_task (smp_processor_id ()) != tsk) +account_system_time (tsk,0 , delta_stime, delta_stime); +else +account_idle_time (delta_stime); ti->ac_stime =0 ; ti->ac_stamp = now;
@@ -143,8 +146,7 @@ void account_process_tick(struct task_struct *p, int user_tick)if (ti->ac_utime) { delta_utime =cycle_to_cputime (ti->ac_utime); -account_user_time (p, delta_utime); -account_user_time_scaled (p, delta_utime); +account_user_time (p, delta_utime, delta_utime); ti->ac_utime =0 ; } }
arch/powerpc/kernel/process.c +1 -0
@@ -33,6 +33,7 @@#include <linux/mqueue.h> #include <linux/hardirq.h> #include <linux/utsname.h> +#include <linux/kernel_stat.h> #include <asm/pgtable.h> #include <asm/uaccess.h>
arch/powerpc/kernel/time.c +11 -7
@@ -256,8 +256,10 @@ void account_system_vtime(struct task_struct *tsk) delta += sys_time;get_paca ()->system_time =0 ; } -account_system_time (tsk,0 , delta); -account_system_time_scaled (tsk, deltascaled); +if (in_irq () ||idle_task (smp_processor_id ()) != tsk) +account_system_time (tsk,0 , delta, deltascaled); +else +account_idle_time (delta);per_cpu (cputime_last_delta,smp_processor_id ()) = delta;per_cpu (cputime_scaled_last_delta,smp_processor_id ()) = deltascaled;local_irq_restore (flags);
@@ -275,10 +277,8 @@ void account_process_tick(struct task_struct *tsk, int user_tick) utime =get_paca ()->user_time;get_paca ()->user_time =0 ; -account_user_time (tsk, utime); - utimescaled =cputime_to_scaled (utime); -account_user_time_scaled (tsk, utimescaled); +account_user_time (tsk, utime, utimescaled); }/*
@@ -338,8 +338,12 @@ void calculate_steal_time(void) tb =mftb (); purr =mfspr (SPRN_PURR ); stolen = (tb - pme->tb) - (purr - pme->purr); -if (stolen >0 ) -account_steal_time (current, stolen); +if (stolen >0 ) { +if (idle_task (smp_processor_id ()) != current) +account_steal_time (stolen); +else +account_idle_time (stolen); + } pme->tb = tb; pme->purr = purr; }
arch/s390/include/asm/cpu.h +3 -4
@@ -14,7 +14,6 @@struct s390_idle_data {spinlock_t lock; -unsigned int in_idle;unsigned long long idle_count;unsigned long long idle_enter;unsigned long long idle_time;
@@ -22,12 +21,12 @@ struct s390_idle_data { DECLARE_PER_CPU(struct s390_idle_data, s390_idle); -void s390_idle_leave (void ); +void vtime_start_cpu (void );static inline void s390_idle_check (void ) { -if ((&__get_cpu_var (s390_idle))->in_idle) -s390_idle_leave (); +if ((&__get_cpu_var (s390_idle))->idle_enter !=0ULL ) +vtime_start_cpu (); }#endif /* _ASM_S390_CPU_H_ */
arch/s390/include/asm/cputime.h +21 -21
128 lines not on this page · raw message
arch/s390/include/asm/lowcore.h +28 -21
87 lines not on this page · raw message
arch/s390/include/asm/system.h +2 -2
@@ -99,7 +99,7 @@ static inline void restore_access_regs(unsigned int *acrs) prev =__switch_to (prev,next); \ }while (0 ) -extern void account_vtime(struct task_struct *); +extern void account_vtime(struct task_struct *, struct task_struct *);extern void account_tick_vtime (struct task_struct *);extern void account_system_vtime (struct task_struct *);
@@ -121,7 +121,7 @@ static inline void cmma_init(void) { }#define finish_arch_switch (prev) do { \ set_fs(current->thread.mm_segment); \ - account_vtime(prev); \ + account_vtime(prev, current); \ } while (0)#define nop () asm volatile("nop")
arch/s390/include/asm/thread_info.h +2 -0
@@ -47,6 +47,8 @@ struct thread_info {unsigned int cpu;/* current CPU */ int preempt_count;/* 0 => preemptable, <0 => BUG */ struct restart_block restart_block; +__u64 user_timer; +__u64 system_timer; };/*
arch/s390/include/asm/timer.h +7 -9
@@ -23,20 +23,18 @@ struct vtimer_list {__u64 expires;__u64 interval; -spinlock_t lock; -unsigned long magic; -void (*function)(unsigned long );unsigned long data; }; -/* the offset value will wrap after ca. 71 years */ +/* the vtimer value will wrap after ca. 71 years */ struct vtimer_queue {struct list_head list;spinlock_t lock; -__u64 to_expire;/* current event expire time */ -__u64 offset;/* list offset to zero */ -__u64 idle;/* temp var for idle */ +__u64 timer;/* last programmed timer */ +__u64 elapsed;/* elapsed time of timer expire values */ +__u64 idle;/* temp var for idle */ +int do_spt;/* =1: reprogram cpu timer in idle */ };extern void init_virt_timer (struct vtimer_list *timer);
@@ -48,8 +46,8 @@ extern int del_virt_timer(struct vtimer_list *timer);extern void init_cpu_vtimer (void );extern void vtime_init (void ); -extern void vtime_start_cpu_timer (void ); -extern void vtime_stop_cpu_timer (void ); +extern void vtime_stop_cpu (void ); +extern void vtime_start_leave (void );#endif /* __KERNEL__ */
arch/s390/include/asm/vdso.h +13 -2
@@ -12,9 +12,9 @@#ifndef __ASSEMBLY__/* -* Note about this structure: +* Note about the vdso_data and vdso_per_cpu_data structures: * -* NEVER USE THIS IN USERSPACE CODE DIRECTLY. The layout of this +* NEVER USE THEM IN USERSPACE CODE DIRECTLY. The layout of the * structure is supposed to be known only to the function in the vdso * itself and may change without notice. */
@@ -28,10 +28,21 @@ struct vdso_data {__u64 wtom_clock_nsec;/* 0x28 */ __u32 tz_minuteswest;/* Minutes west of Greenwich 0x30 */ __u32 tz_dsttime;/* Type of dst correction 0x34 */ +__u32 ectg_available; +}; + +struct vdso_per_cpu_data { +__u64 ectg_timer_base; +__u64 ectg_user_time; };extern struct vdso_data *vdso_data; +#ifdef CONFIG_64BIT +int vdso_alloc_per_cpu (int cpu,struct _lowcore *lowcore); +void vdso_free_per_cpu (int cpu,struct _lowcore *lowcore); +#endif +#endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */
arch/s390/kernel/asm-offsets.c +5 -0
@@ -48,6 +48,11 @@ int main(void)DEFINE (__VDSO_WTOM_SEC, offsetof(struct vdso_data , wtom_clock_sec));DEFINE (__VDSO_WTOM_NSEC, offsetof(struct vdso_data , wtom_clock_nsec));DEFINE (__VDSO_TIMEZONE, offsetof(struct vdso_data , tz_minuteswest)); +DEFINE (__VDSO_ECTG_OK, offsetof(struct vdso_data , ectg_available)); +DEFINE (__VDSO_ECTG_BASE, + offsetof(struct vdso_per_cpu_data , ectg_timer_base)); +DEFINE (__VDSO_ECTG_USER, + offsetof(struct vdso_per_cpu_data , ectg_user_time));/* constants used by the vdso */ DEFINE (CLOCK_REALTIME ,CLOCK_REALTIME );DEFINE (CLOCK_MONOTONIC ,CLOCK_MONOTONIC );
arch/s390/kernel/entry.S +3 -2
@@ -583,8 +583,8 @@ kernel_per: .globl io_int_handler io_int_handler: - stpt __LC_ASYNC_ENTER_TIMER stck __LC_INT_CLOCK + stpt __LC_ASYNC_ENTER_TIMER SAVE_ALL_BASE __LC_SAVE_AREA+16 SAVE_ALL_ASYNC __LC_IO_OLD_PSW,__LC_SAVE_AREA+16 CREATE_STACK_FRAME __LC_IO_OLD_PSW,__LC_SAVE_AREA+16
@@ -723,8 +723,8 @@ io_notify_resume: .globl ext_int_handler ext_int_handler: - stpt __LC_ASYNC_ENTER_TIMER stck __LC_INT_CLOCK + stpt __LC_ASYNC_ENTER_TIMER SAVE_ALL_BASE __LC_SAVE_AREA+16 SAVE_ALL_ASYNC __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16 CREATE_STACK_FRAME __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16
@@ -750,6 +750,7 @@ __critical_end: .globl mcck_int_handler mcck_int_handler: + stck __LC_INT_CLOCK spt __LC_CPU_TIMER_SAVE_AREA # revalidate cpu timer lm %r0,%r15,__LC_GPREGS_SAVE_AREA # revalidate gprs SAVE_ALL_BASE __LC_SAVE_AREA+32
arch/s390/kernel/entry64.S +27 -23
103 lines not on this page · raw message
arch/s390/kernel/head64.S +2 -0
@@ -87,6 +87,8 @@ startup_continue: lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area # move IPL device to lowcore mvc __LC_IPLDEV(4),IPL_DEVICE+4-PARMAREA(%r12) + lghi %r0,__LC_PASTE + stg %r0,__LC_VDSO_PER_CPU # # Setup stack #
arch/s390/kernel/process.c +4 -39
79 lines not on this page · raw message
arch/s390/kernel/s390_ext.c +1 -1
@@ -119,8 +119,8 @@ void do_extint(struct pt_regs *regs, unsigned short code)struct pt_regs *old_regs; old_regs =set_irq_regs (regs); -irq_enter ();s390_idle_check (); +irq_enter ();if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)/* Serve timer interrupts first. */ clock_comparator_work ();
arch/s390/kernel/setup.c +2 -0
@@ -427,6 +427,8 @@ setup_lowcore(void)/* enable extended save area */ __ctl_set_bit(14, 29); } +#else + lc->vdso_per_cpu_data = (unsigned long ) &lc->paste[0 ];#endif set_prefix ((u32 )(unsigned long ) lc); }
arch/s390/kernel/smp.c +22 -12
@@ -47,6 +47,7 @@#include <asm/lowcore.h> #include <asm/sclp.h> #include <asm/cpu.h> +#include <asm/vdso.h> #include "entry.h" /*
@@ -506,6 +507,9 @@ static int __cpuinit smp_alloc_lowcore(int cpu) goto out; lowcore->extended_save_area_addr = (u32) save_area; } +#else +if (vdso_alloc_per_cpu (cpu, lowcore)) + goto out;#endif lowcore_ptr[cpu] = lowcore;return 0 ;
@@ -528,6 +532,8 @@ static void smp_free_lowcore(int cpu)#ifndef CONFIG_64BIT if (MACHINE_HAS_IEEE )free_page ((unsigned long ) lowcore->extended_save_area_addr); +#else +vdso_free_per_cpu (cpu, lowcore);#endif free_page (lowcore->panic_stack -PAGE_SIZE );free_pages (lowcore->async_stack -ASYNC_SIZE ,ASYNC_ORDER );
@@ -670,6 +676,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) lowcore = (void *)__get_free_pages (GFP_KERNEL |GFP_DMA , lc_order); panic_stack =__get_free_page (GFP_KERNEL ); async_stack =__get_free_pages (GFP_KERNEL ,ASYNC_ORDER ); +BUG_ON (!lowcore || !panic_stack || !async_stack);#ifndef CONFIG_64BIT if (MACHINE_HAS_IEEE ) save_area =get_zeroed_page (GFP_KERNEL );
@@ -683,6 +690,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)#ifndef CONFIG_64BIT if (MACHINE_HAS_IEEE ) lowcore->extended_save_area_addr = (u32 ) save_area; +#else +BUG_ON (vdso_alloc_per_cpu (smp_processor_id (), lowcore));#endif set_prefix ((u32 )(unsigned long ) lowcore);local_mcck_enable ();
@@ -851,9 +860,11 @@ static ssize_t show_idle_count(struct sys_device *dev,unsigned long long idle_count; idle = &per_cpu (s390_idle, dev->id); -spin_lock_irq (&idle->lock); +spin_lock (&idle->lock); idle_count = idle->idle_count; -spin_unlock_irq (&idle->lock); +if (idle->idle_enter) + idle_count++; +spin_unlock (&idle->lock);return sprintf (buf,"%llu\n" , idle_count); } static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL);
@@ -862,18 +873,17 @@ static ssize_t show_idle_time(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) { struct s390_idle_data *idle; -unsigned long long new_time; +unsigned long long now, idle_time, idle_enter; idle = &per_cpu (s390_idle, dev->id); -spin_lock_irq (&idle->lock); -if (idle->in_idle) { - new_time =get_clock (); - idle->idle_time += new_time - idle->idle_enter; - idle->idle_enter = new_time; - } - new_time = idle->idle_time; -spin_unlock_irq (&idle->lock); -return sprintf (buf,"%llu\n" , new_time >>12 ); +spin_lock (&idle->lock); + now =get_clock (); + idle_time = idle->idle_time; + idle_enter = idle->idle_enter; +if (idle_enter !=0ULL && idle_enter < now) + idle_time += now - idle_enter; +spin_unlock (&idle->lock); +return sprintf (buf,"%llu\n" , idle_time >>12 ); } static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);
arch/s390/kernel/vdso.c +120 -3
147 lines not on this page · raw message
arch/s390/kernel/vdso64/clock_getres.S +5 -0
@@ -22,7 +22,12 @@ __kernel_clock_getres: cghi %r2,CLOCK_REALTIME je 0f cghi %r2,CLOCK_MONOTONIC + je 0f + cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ jne 2f + larl %r5,_vdso_data + icm %r0,15,__LC_ECTG_OK(%r5) + jz 2f 0: ltgr %r3,%r3 jz 1f /* res == NULL */ larl %r1,3f
arch/s390/kernel/vdso64/clock_gettime.S +34 -5
@@ -22,8 +22,10 @@ __kernel_clock_gettime: larl %r5,_vdso_data cghi %r2,CLOCK_REALTIME je 4f + cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ + je 9f cghi %r2,CLOCK_MONOTONIC - jne 9f + jne 12f /* CLOCK_MONOTONIC */ ltgr %r3,%r3
@@ -42,7 +44,7 @@ __kernel_clock_gettime: alg %r0,__VDSO_WTOM_SEC(%r5) clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ jne 0b - larl %r5,10f + larl %r5,13f 1: clg %r1,0(%r5) jl 2f slg %r1,0(%r5)
@@ -68,7 +70,7 @@ __kernel_clock_gettime: lg %r0,__VDSO_XTIME_SEC(%r5) clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ jne 5b - larl %r5,10f + larl %r5,13f 6: clg %r1,0(%r5) jl 7f slg %r1,0(%r5)
@@ -79,11 +81,38 @@ __kernel_clock_gettime: 8: lghi %r2,0 br %r14 + /* CLOCK_THREAD_CPUTIME_ID for this thread */ +9: icm %r0,15,__VDSO_ECTG_OK(%r5) + jz 12f + ear %r2,%a4 + llilh %r4,0x0100 + sar %a4,%r4 + lghi %r4,0 + sacf 512 /* Magic ectg instruction */ + .insn ssf,0xc80100000000,__VDSO_ECTG_BASE(4),__VDSO_ECTG_USER(4),4 + sacf 0 + sar %a4,%r2 + algr %r1,%r0 /* r1 = cputime as TOD value */ + mghi %r1,1000 /* convert to nanoseconds */ + srlg %r1,%r1,12 /* r1 = cputime in nanosec */ + lgr %r4,%r1 + larl %r5,13f + srlg %r1,%r1,9 /* divide by 1000000000 */ + mlg %r0,8(%r5) + srlg %r0,%r0,11 /* r0 = tv_sec */ + stg %r0,0(%r3) + msg %r0,0(%r5) /* calculate tv_nsec */ + slgr %r4,%r0 /* r4 = tv_nsec */ + stg %r4,8(%r3) + lghi %r2,0 + br %r14 + /* Fallback to system call */ -9: lghi %r1,__NR_clock_gettime +12: lghi %r1,__NR_clock_gettime svc 0 br %r14 -10: .quad 1000000000 +13: .quad 1000000000 +14: .quad 19342813113834067 .cfi_endproc .size __kernel_clock_gettime,.-__kernel_clock_gettime
arch/s390/kernel/vtime.c +262 -224
636 lines not on this page · raw message
arch/x86/xen/time.c +4 -6
@@ -132,8 +132,7 @@ static void do_stolen_accounting(void) *snap = state;/* Add the appropriate number of ticks of stolen time, -including any left-overs from last time. Passing NULL to -account_steal_time accounts the time as stolen. */ +including any left-overs from last time. */ stolen = runnable + offline +__get_cpu_var (residual_stolen);if (stolen <0 )
@@ -141,11 +140,10 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (stolen,NS_PER_TICK , &stolen);__get_cpu_var (residual_stolen) = stolen; -account_steal_time (NULL , ticks); +account_steal_ticks (ticks);/* Add the appropriate number of ticks of blocked time, -including any left-overs from last time. Passing idle to -account_steal_time accounts the time as idle/wait. */ +including any left-overs from last time. */ blocked +=__get_cpu_var (residual_blocked);if (blocked <0 )
@@ -153,7 +151,7 @@ static void do_stolen_accounting(void) ticks =iter_div_u64_rem (blocked,NS_PER_TICK , &blocked);__get_cpu_var (residual_blocked) = blocked; -account_steal_time (idle_task (smp_processor_id ()), ticks); +account_idle_ticks (ticks); }/*
drivers/s390/cio/cio.c +1 -1
@@ -632,8 +632,8 @@ do_IRQ (struct pt_regs *regs)struct pt_regs *old_regs; old_regs =set_irq_regs (regs); -irq_enter ();s390_idle_check (); +irq_enter ();if (S390_lowcore.int_clock >= S390_lowcore.clock_comparator)/* Serve timer interrupts first. */ clock_comparator_work ();
drivers/s390/s390mach.c +3 -0
@@ -18,6 +18,7 @@#include <asm/etr.h> #include <asm/lowcore.h> #include <asm/cio.h> +#include <asm/cpu.h> #include "s390mach.h" static struct semaphore m_sem;
@@ -369,6 +370,8 @@ s390_do_machine_check(struct pt_regs *regs)lockdep_off (); +s390_idle_check (); + mci = (struct mci *) &S390_lowcore.mcck_interruption_code; mcck = &__get_cpu_var (cpu_mcck); umode =user_mode (regs);
include/linux/kernel_stat.h +8 -5
@@ -79,10 +79,13 @@ static inline unsigned int kstat_irqs(unsigned int irq) }extern unsigned long long task_delta_exec (struct task_struct *); -extern void account_user_time (struct task_struct *,cputime_t ); -extern void account_user_time_scaled (struct task_struct *,cputime_t ); -extern void account_system_time (struct task_struct *,int ,cputime_t ); -extern void account_system_time_scaled (struct task_struct *,cputime_t ); -extern void account_steal_time (struct task_struct *,cputime_t ); +extern void account_user_time (struct task_struct *,cputime_t ,cputime_t ); +extern void account_system_time (struct task_struct *,int ,cputime_t ,cputime_t ); +extern void account_steal_time (cputime_t ); +extern void account_idle_time (cputime_t ); + +extern void account_process_tick (struct task_struct *,int user); +extern void account_steal_ticks (unsigned long ticks); +extern void account_idle_ticks (unsigned long ticks);#endif /* _LINUX_KERNEL_STAT_H */
include/linux/sched.h +0 -1
@@ -284,7 +284,6 @@ long io_schedule_timeout(long timeout);extern void cpu_init (void );extern void trap_init (void ); -extern void account_process_tick (struct task_struct *task,int user);extern void update_process_times (int user);extern void scheduler_tick (void );
kernel/sched.c +76 -39
188 lines not on this page · raw message
kernel/time/tick-sched.c +6 -6
@@ -419,7 +419,9 @@ void tick_nohz_restart_sched_tick(void) {int cpu =smp_processor_id ();struct tick_sched *ts = &per_cpu (tick_cpu_sched, cpu); +#ifndef CONFIG_VIRT_CPU_ACCOUNTING unsigned long ticks; +#endif ktime_t now;local_irq_disable ();
@@ -441,6 +443,7 @@ void tick_nohz_restart_sched_tick(void)tick_do_update_jiffies64 (now);cpu_clear (cpu, nohz_cpu_mask); +#ifndef CONFIG_VIRT_CPU_ACCOUNTING /* * We stopped the tick in idle. Update process times would miss the * time we slept as update_process_times does only a 1 tick
@@ -450,12 +453,9 @@ void tick_nohz_restart_sched_tick(void)/* * We might be one off. Do not randomly account a huge number of ticks! */ -if (ticks && ticks <LONG_MAX ) { -add_preempt_count (HARDIRQ_OFFSET ); -account_system_time (current,HARDIRQ_OFFSET , -jiffies_to_cputime (ticks)); -sub_preempt_count (HARDIRQ_OFFSET ); - } +if (ticks && ticks <LONG_MAX ) +account_idle_ticks (ticks); +#endif touch_softlockup_watchdog ();/*
kernel/timer.c +0 -15
@@ -1018,21 +1018,6 @@ unsigned long get_next_timer_interrupt(unsigned long now) }#endif -#ifndef CONFIG_VIRT_CPU_ACCOUNTING -void account_process_tick (struct task_struct *p,int user_tick) -{ -cputime_t one_jiffy =jiffies_to_cputime (1 ); - -if (user_tick) { -account_user_time (p, one_jiffy); -account_user_time_scaled (p,cputime_to_scaled (one_jiffy)); - }else { -account_system_time (p,HARDIRQ_OFFSET , one_jiffy); -account_system_time_scaled (p,cputime_to_scaled (one_jiffy)); - } -} -#endif -/* * Called from the timer interrupt handler to charge one tick to the current * process. user_tick is 1 if the tick is user time, 0 for system.