Skip to content

Commit d652e1e

Browse files
committed
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler changes from Ingo Molnar: "Main changes: - scheduler side full-dynticks (user-space execution is undisturbed and receives no timer IRQs) preparation changes that convert the cputime accounting code to be full-dynticks ready, from Frederic Weisbecker. - Initial sched.h split-up changes, by Clark Williams - select_idle_sibling() performance improvement by Mike Galbraith: " 1 tbench pair (worst case) in a 10 core + SMT package: pre 15.22 MB/sec 1 procs post 252.01 MB/sec 1 procs " - sched_rr_get_interval() ABI fix/change. We think this detail is not used by apps (so it's not an ABI in practice), but lets keep it under observation. - misc RT scheduling cleanups, optimizations" * 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) sched/rt: Add <linux/sched/rt.h> header to <linux/init_task.h> cputime: Remove irqsave from seqlock readers sched, powerpc: Fix sched.h split-up build failure cputime: Restore CPU_ACCOUNTING config defaults for PPC64 sched/rt: Move rt specific bits into new header file sched/rt: Add a tuning knob to allow changing SCHED_RR timeslice sched: Move sched.h sysctl bits into separate header sched: Fix signedness bug in yield_to() sched: Fix select_idle_sibling() bouncing cow syndrome sched/rt: Further simplify pick_rt_task() sched/rt: Do not account zero delta_exec in update_curr_rt() cputime: Safely read cputime of full dynticks CPUs kvm: Prepare to add generic guest entry/exit callbacks cputime: Use accessors to read task cputime stats cputime: Allow dynamic switch between tick/virtual based cputime accounting cputime: Generic on-demand virtual cputime accounting cputime: Move default nsecs_to_cputime() to jiffies based cputime file cputime: Librarize per nsecs resolution cputime definitions cputime: Avoid multiplication overflow on utime scaling context_tracking: Export context state for generic vtime ... Fix up conflict in kernel/context_tracking.c due to comment additions.
2 parents 8f55cea + 77852fe commit d652e1e

83 files changed

Lines changed: 1105 additions & 507 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/alpha/kernel/osf_sys.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,15 +1139,17 @@ struct rusage32 {
11391139
SYSCALL_DEFINE2(osf_getrusage, int, who, struct rusage32 __user *, ru)
11401140
{
11411141
struct rusage32 r;
1142+
cputime_t utime, stime;
11421143

11431144
if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN)
11441145
return -EINVAL;
11451146

11461147
memset(&r, 0, sizeof(r));
11471148
switch (who) {
11481149
case RUSAGE_SELF:
1149-
jiffies_to_timeval32(current->utime, &r.ru_utime);
1150-
jiffies_to_timeval32(current->stime, &r.ru_stime);
1150+
task_cputime(current, &utime, &stime);
1151+
jiffies_to_timeval32(utime, &r.ru_utime);
1152+
jiffies_to_timeval32(stime, &r.ru_stime);
11511153
r.ru_minflt = current->min_flt;
11521154
r.ru_majflt = current->maj_flt;
11531155
break;

‎arch/ia64/include/asm/cputime.h‎

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -11,99 +11,19 @@
1111
* as published by the Free Software Foundation; either version
1212
* 2 of the License, or (at your option) any later version.
1313
*
14-
* If we have CONFIG_VIRT_CPU_ACCOUNTING, we measure cpu time in nsec.
14+
* If we have CONFIG_VIRT_CPU_ACCOUNTING_NATIVE, we measure cpu time in nsec.
1515
* Otherwise we measure cpu time in jiffies using the generic definitions.
1616
*/
1717

1818
#ifndef __IA64_CPUTIME_H
1919
#define __IA64_CPUTIME_H
2020

21-
#ifndef CONFIG_VIRT_CPU_ACCOUNTING
22-
#include <asm-generic/cputime.h>
21+
#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
22+
# include <asm-generic/cputime.h>
2323
#else
24-
25-
#include <linux/time.h>
26-
#include <linux/jiffies.h>
27-
#include <asm/processor.h>
28-
29-
typedef u64 __nocast cputime_t;
30-
typedef u64 __nocast cputime64_t;
31-
32-
#define cputime_one_jiffy jiffies_to_cputime(1)
33-
34-
/*
35-
* Convert cputime <-> jiffies (HZ)
36-
*/
37-
#define cputime_to_jiffies(__ct) \
38-
((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
39-
#define jiffies_to_cputime(__jif) \
40-
(__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
41-
#define cputime64_to_jiffies64(__ct) \
42-
((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
43-
#define jiffies64_to_cputime64(__jif) \
44-
(__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
45-
46-
/*
47-
* Convert cputime <-> microseconds
48-
*/
49-
#define cputime_to_usecs(__ct) \
50-
((__force u64)(__ct) / NSEC_PER_USEC)
51-
#define usecs_to_cputime(__usecs) \
52-
(__force cputime_t)((__usecs) * NSEC_PER_USEC)
53-
#define usecs_to_cputime64(__usecs) \
54-
(__force cputime64_t)((__usecs) * NSEC_PER_USEC)
55-
56-
/*
57-
* Convert cputime <-> seconds
58-
*/
59-
#define cputime_to_secs(__ct) \
60-
((__force u64)(__ct) / NSEC_PER_SEC)
61-
#define secs_to_cputime(__secs) \
62-
(__force cputime_t)((__secs) * NSEC_PER_SEC)
63-
64-
/*
65-
* Convert cputime <-> timespec (nsec)
66-
*/
67-
static inline cputime_t timespec_to_cputime(const struct timespec *val)
68-
{
69-
u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
70-
return (__force cputime_t) ret;
71-
}
72-
static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
73-
{
74-
val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
75-
val->tv_nsec = (__force u64) ct % NSEC_PER_SEC;
76-
}
77-
78-
/*
79-
* Convert cputime <-> timeval (msec)
80-
*/
81-
static inline cputime_t timeval_to_cputime(struct timeval *val)
82-
{
83-
u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC;
84-
return (__force cputime_t) ret;
85-
}
86-
static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
87-
{
88-
val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
89-
val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC;
90-
}
91-
92-
/*
93-
* Convert cputime <-> clock (USER_HZ)
94-
*/
95-
#define cputime_to_clock_t(__ct) \
96-
((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ))
97-
#define clock_t_to_cputime(__x) \
98-
(__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
99-
100-
/*
101-
* Convert cputime64 to clock.
102-
*/
103-
#define cputime64_to_clock_t(__ct) \
104-
cputime_to_clock_t((__force cputime_t)__ct)
105-
24+
# include <asm/processor.h>
25+
# include <asm-generic/cputime_nsecs.h>
10626
extern void arch_vtime_task_switch(struct task_struct *tsk);
27+
#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
10728

108-
#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
10929
#endif /* __IA64_CPUTIME_H */

‎arch/ia64/include/asm/thread_info.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct thread_info {
3131
mm_segment_t addr_limit; /* user-level address space limit */
3232
int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
3333
struct restart_block restart_block;
34-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
34+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
3535
__u64 ac_stamp;
3636
__u64 ac_leave;
3737
__u64 ac_stime;
@@ -69,7 +69,7 @@ struct thread_info {
6969
#define task_stack_page(tsk) ((void *)(tsk))
7070

7171
#define __HAVE_THREAD_FUNCTIONS
72-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
72+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
7373
#define setup_thread_stack(p, org) \
7474
*task_thread_info(p) = *task_thread_info(org); \
7575
task_thread_info(p)->ac_stime = 0; \

‎arch/ia64/include/asm/xen/minstate.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
2+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
33
/* read ar.itc in advance, and use it before leaving bank 0 */
44
#define XEN_ACCOUNT_GET_STAMP \
55
MOV_FROM_ITC(pUStk, p6, r20, r2);

‎arch/ia64/kernel/asm-offsets.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void foo(void)
4141
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
4242
DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
4343
DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
44-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
44+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
4545
DEFINE(TI_AC_STAMP, offsetof(struct thread_info, ac_stamp));
4646
DEFINE(TI_AC_LEAVE, offsetof(struct thread_info, ac_leave));
4747
DEFINE(TI_AC_STIME, offsetof(struct thread_info, ac_stime));

‎arch/ia64/kernel/entry.S‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ GLOBAL_ENTRY(__paravirt_leave_syscall)
724724
#endif
725725
.global __paravirt_work_processed_syscall;
726726
__paravirt_work_processed_syscall:
727-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
727+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
728728
adds r2=PT(LOADRS)+16,r12
729729
MOV_FROM_ITC(pUStk, p9, r22, r19) // fetch time at leave
730730
adds r18=TI_FLAGS+IA64_TASK_SIZE,r13
@@ -762,7 +762,7 @@ __paravirt_work_processed_syscall:
762762

763763
ld8 r29=[r2],16 // M0|1 load cr.ipsr
764764
ld8 r28=[r3],16 // M0|1 load cr.iip
765-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
765+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
766766
(pUStk) add r14=TI_AC_LEAVE+IA64_TASK_SIZE,r13
767767
;;
768768
ld8 r30=[r2],16 // M0|1 load cr.ifs
@@ -793,7 +793,7 @@ __paravirt_work_processed_syscall:
793793
ld8.fill r1=[r3],16 // M0|1 load r1
794794
(pUStk) mov r17=1 // A
795795
;;
796-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
796+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
797797
(pUStk) st1 [r15]=r17 // M2|3
798798
#else
799799
(pUStk) st1 [r14]=r17 // M2|3
@@ -813,7 +813,7 @@ __paravirt_work_processed_syscall:
813813
shr.u r18=r19,16 // I0|1 get byte size of existing "dirty" partition
814814
COVER // B add current frame into dirty partition & set cr.ifs
815815
;;
816-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
816+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
817817
mov r19=ar.bsp // M2 get new backing store pointer
818818
st8 [r14]=r22 // M save time at leave
819819
mov f10=f0 // F clear f10
@@ -948,7 +948,7 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)
948948
adds r16=PT(CR_IPSR)+16,r12
949949
adds r17=PT(CR_IIP)+16,r12
950950

951-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
951+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
952952
.pred.rel.mutex pUStk,pKStk
953953
MOV_FROM_PSR(pKStk, r22, r29) // M2 read PSR now that interrupts are disabled
954954
MOV_FROM_ITC(pUStk, p9, r22, r29) // M fetch time at leave
@@ -981,23 +981,23 @@ GLOBAL_ENTRY(__paravirt_leave_kernel)
981981
;;
982982
ld8.fill r12=[r16],16
983983
ld8.fill r13=[r17],16
984-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
984+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
985985
(pUStk) adds r3=TI_AC_LEAVE+IA64_TASK_SIZE,r18
986986
#else
987987
(pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18
988988
#endif
989989
;;
990990
ld8 r20=[r16],16 // ar.fpsr
991991
ld8.fill r15=[r17],16
992-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
992+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
993993
(pUStk) adds r18=IA64_TASK_THREAD_ON_USTACK_OFFSET,r18 // deferred
994994
#endif
995995
;;
996996
ld8.fill r14=[r16],16
997997
ld8.fill r2=[r17]
998998
(pUStk) mov r17=1
999999
;;
1000-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1000+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
10011001
// mmi_ : ld8 st1 shr;; mmi_ : st8 st1 shr;;
10021002
// mib : mov add br -> mib : ld8 add br
10031003
// bbb_ : br nop cover;; mbb_ : mov br cover;;

‎arch/ia64/kernel/fsys.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)
529529
nop.i 0
530530
;;
531531
mov ar.rsc=0 // M2 set enforced lazy mode, pl 0, LE, loadrs=0
532-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
532+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
533533
MOV_FROM_ITC(p0, p6, r30, r23) // M get cycle for accounting
534534
#else
535535
nop.m 0
@@ -555,7 +555,7 @@ GLOBAL_ENTRY(paravirt_fsys_bubble_down)
555555
cmp.ne pKStk,pUStk=r0,r0 // A set pKStk <- 0, pUStk <- 1
556556
br.call.sptk.many b7=ia64_syscall_setup // B
557557
;;
558-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
558+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
559559
// mov.m r30=ar.itc is called in advance
560560
add r16=TI_AC_STAMP+IA64_TASK_SIZE,r2
561561
add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r2

‎arch/ia64/kernel/head.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ END(ia64_native_sched_clock)
10731073
sched_clock = ia64_native_sched_clock
10741074
#endif
10751075

1076-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1076+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
10771077
GLOBAL_ENTRY(cycle_to_cputime)
10781078
alloc r16=ar.pfs,1,0,0,0
10791079
addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
@@ -1091,7 +1091,7 @@ GLOBAL_ENTRY(cycle_to_cputime)
10911091
shrp r8=r9,r8,IA64_NSEC_PER_CYC_SHIFT
10921092
br.ret.sptk.many rp
10931093
END(cycle_to_cputime)
1094-
#endif /* CONFIG_VIRT_CPU_ACCOUNTING */
1094+
#endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
10951095

10961096
#ifdef CONFIG_IA64_BRL_EMU
10971097

‎arch/ia64/kernel/ivt.S‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ ENTRY(break_fault)
784784

785785
(p8) adds r28=16,r28 // A switch cr.iip to next bundle
786786
(p9) adds r8=1,r8 // A increment ei to next slot
787-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
787+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
788788
;;
789789
mov b6=r30 // I0 setup syscall handler branch reg early
790790
#else
@@ -801,7 +801,7 @@ ENTRY(break_fault)
801801
//
802802
///////////////////////////////////////////////////////////////////////
803803
st1 [r16]=r0 // M2|3 clear current->thread.on_ustack flag
804-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
804+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
805805
MOV_FROM_ITC(p0, p14, r30, r18) // M get cycle for accounting
806806
#else
807807
mov b6=r30 // I0 setup syscall handler branch reg early
@@ -817,7 +817,7 @@ ENTRY(break_fault)
817817
cmp.eq p14,p0=r9,r0 // A are syscalls being traced/audited?
818818
br.call.sptk.many b7=ia64_syscall_setup // B
819819
1:
820-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
820+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
821821
// mov.m r30=ar.itc is called in advance, and r13 is current
822822
add r16=TI_AC_STAMP+IA64_TASK_SIZE,r13 // A
823823
add r17=TI_AC_LEAVE+IA64_TASK_SIZE,r13 // A
@@ -1043,7 +1043,7 @@ END(ia64_syscall_setup)
10431043
DBG_FAULT(16)
10441044
FAULT(16)
10451045

1046-
#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(__IA64_ASM_PARAVIRTUALIZED_NATIVE)
1046+
#if defined(CONFIG_VIRT_CPU_ACCOUNTING_NATIVE) && defined(__IA64_ASM_PARAVIRTUALIZED_NATIVE)
10471047
/*
10481048
* There is no particular reason for this code to be here, other than
10491049
* that there happens to be space here that would go unused otherwise.

‎arch/ia64/kernel/minstate.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "entry.h"
55
#include "paravirt_inst.h"
66

7-
#ifdef CONFIG_VIRT_CPU_ACCOUNTING
7+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
88
/* read ar.itc in advance, and use it before leaving bank 0 */
99
#define ACCOUNT_GET_STAMP \
1010
(pUStk) mov.m r20=ar.itc;

0 commit comments

Comments
 (0)