s390: move cputime accounting fields from thread_info to thread_struct
The user_timer and system_timer fields are used for the per-thread cputime accounting code. The access to these values is simpler if they are moved to the thread_struct as the task_thread_info(tsk) indirection is not needed anymore. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>hifive-unleashed-5.1
parent
f8fc82b471
commit
90c53e6580
|
@ -110,6 +110,8 @@ typedef struct {
|
||||||
struct thread_struct {
|
struct thread_struct {
|
||||||
unsigned int acrs[NUM_ACRS];
|
unsigned int acrs[NUM_ACRS];
|
||||||
unsigned long ksp; /* kernel stack pointer */
|
unsigned long ksp; /* kernel stack pointer */
|
||||||
|
unsigned long user_timer; /* task cputime in user space */
|
||||||
|
unsigned long system_timer; /* task cputime in kernel space */
|
||||||
mm_segment_t mm_segment;
|
mm_segment_t mm_segment;
|
||||||
unsigned long gmap_addr; /* address of last gmap fault. */
|
unsigned long gmap_addr; /* address of last gmap fault. */
|
||||||
unsigned int gmap_write_flag; /* gmap fault write indication */
|
unsigned int gmap_write_flag; /* gmap fault write indication */
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
struct thread_info {
|
struct thread_info {
|
||||||
unsigned long flags; /* low level flags */
|
unsigned long flags; /* low level flags */
|
||||||
unsigned long sys_call_table; /* System call table address */
|
unsigned long sys_call_table; /* System call table address */
|
||||||
__u64 user_timer;
|
|
||||||
__u64 system_timer;
|
|
||||||
unsigned long last_break; /* last breaking-event-address. */
|
unsigned long last_break; /* last breaking-event-address. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,6 @@ int main(void)
|
||||||
/* thread info offsets */
|
/* thread info offsets */
|
||||||
OFFSET(__TI_flags, task_struct, thread_info.flags);
|
OFFSET(__TI_flags, task_struct, thread_info.flags);
|
||||||
OFFSET(__TI_sysc_table, task_struct, thread_info.sys_call_table);
|
OFFSET(__TI_sysc_table, task_struct, thread_info.sys_call_table);
|
||||||
OFFSET(__TI_user_timer, task_struct, thread_info.user_timer);
|
|
||||||
OFFSET(__TI_system_timer, task_struct, thread_info.system_timer);
|
|
||||||
OFFSET(__TI_last_break, task_struct, thread_info.last_break);
|
OFFSET(__TI_last_break, task_struct, thread_info.last_break);
|
||||||
BLANK();
|
BLANK();
|
||||||
/* pt_regs offsets */
|
/* pt_regs offsets */
|
||||||
|
|
|
@ -103,7 +103,6 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
|
||||||
int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
|
int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
|
||||||
unsigned long arg, struct task_struct *p)
|
unsigned long arg, struct task_struct *p)
|
||||||
{
|
{
|
||||||
struct thread_info *ti;
|
|
||||||
struct fake_frame
|
struct fake_frame
|
||||||
{
|
{
|
||||||
struct stack_frame sf;
|
struct stack_frame sf;
|
||||||
|
@ -121,9 +120,8 @@ int copy_thread(unsigned long clone_flags, unsigned long new_stackp,
|
||||||
memset(&p->thread.per_event, 0, sizeof(p->thread.per_event));
|
memset(&p->thread.per_event, 0, sizeof(p->thread.per_event));
|
||||||
clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
|
clear_tsk_thread_flag(p, TIF_SINGLE_STEP);
|
||||||
/* Initialize per thread user and system timer values */
|
/* Initialize per thread user and system timer values */
|
||||||
ti = task_thread_info(p);
|
p->thread.user_timer = 0;
|
||||||
ti->user_timer = 0;
|
p->thread.system_timer = 0;
|
||||||
ti->system_timer = 0;
|
|
||||||
|
|
||||||
frame->sf.back_chain = 0;
|
frame->sf.back_chain = 0;
|
||||||
/* new return point is ret_from_fork */
|
/* new return point is ret_from_fork */
|
||||||
|
|
|
@ -259,15 +259,14 @@ static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu)
|
||||||
static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk)
|
static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk)
|
||||||
{
|
{
|
||||||
struct lowcore *lc = pcpu->lowcore;
|
struct lowcore *lc = pcpu->lowcore;
|
||||||
struct thread_info *ti = task_thread_info(tsk);
|
|
||||||
|
|
||||||
lc->kernel_stack = (unsigned long) task_stack_page(tsk)
|
lc->kernel_stack = (unsigned long) task_stack_page(tsk)
|
||||||
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
|
+ THREAD_SIZE - STACK_FRAME_OVERHEAD - sizeof(struct pt_regs);
|
||||||
lc->current_task = (unsigned long) tsk;
|
lc->current_task = (unsigned long) tsk;
|
||||||
lc->lpp = LPP_MAGIC;
|
lc->lpp = LPP_MAGIC;
|
||||||
lc->current_pid = tsk->pid;
|
lc->current_pid = tsk->pid;
|
||||||
lc->user_timer = ti->user_timer;
|
lc->user_timer = tsk->thread.user_timer;
|
||||||
lc->system_timer = ti->system_timer;
|
lc->system_timer = tsk->thread.system_timer;
|
||||||
lc->steal_timer = 0;
|
lc->steal_timer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ static void update_mt_scaling(void)
|
||||||
*/
|
*/
|
||||||
static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
|
static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
|
||||||
{
|
{
|
||||||
struct thread_info *ti = task_thread_info(tsk);
|
|
||||||
u64 timer, clock, user, system, steal;
|
u64 timer, clock, user, system, steal;
|
||||||
u64 user_scaled, system_scaled;
|
u64 user_scaled, system_scaled;
|
||||||
|
|
||||||
|
@ -119,13 +118,13 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
|
||||||
time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
|
time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
|
||||||
update_mt_scaling();
|
update_mt_scaling();
|
||||||
|
|
||||||
user = S390_lowcore.user_timer - ti->user_timer;
|
user = S390_lowcore.user_timer - tsk->thread.user_timer;
|
||||||
S390_lowcore.steal_timer -= user;
|
S390_lowcore.steal_timer -= user;
|
||||||
ti->user_timer = S390_lowcore.user_timer;
|
tsk->thread.user_timer = S390_lowcore.user_timer;
|
||||||
|
|
||||||
system = S390_lowcore.system_timer - ti->system_timer;
|
system = S390_lowcore.system_timer - tsk->thread.system_timer;
|
||||||
S390_lowcore.steal_timer -= system;
|
S390_lowcore.steal_timer -= system;
|
||||||
ti->system_timer = S390_lowcore.system_timer;
|
tsk->thread.system_timer = S390_lowcore.system_timer;
|
||||||
|
|
||||||
user_scaled = user;
|
user_scaled = user;
|
||||||
system_scaled = system;
|
system_scaled = system;
|
||||||
|
@ -151,15 +150,11 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset)
|
||||||
|
|
||||||
void vtime_task_switch(struct task_struct *prev)
|
void vtime_task_switch(struct task_struct *prev)
|
||||||
{
|
{
|
||||||
struct thread_info *ti;
|
|
||||||
|
|
||||||
do_account_vtime(prev, 0);
|
do_account_vtime(prev, 0);
|
||||||
ti = task_thread_info(prev);
|
prev->thread.user_timer = S390_lowcore.user_timer;
|
||||||
ti->user_timer = S390_lowcore.user_timer;
|
prev->thread.system_timer = S390_lowcore.system_timer;
|
||||||
ti->system_timer = S390_lowcore.system_timer;
|
S390_lowcore.user_timer = current->thread.user_timer;
|
||||||
ti = task_thread_info(current);
|
S390_lowcore.system_timer = current->thread.system_timer;
|
||||||
S390_lowcore.user_timer = ti->user_timer;
|
|
||||||
S390_lowcore.system_timer = ti->system_timer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -179,7 +174,6 @@ void vtime_account_user(struct task_struct *tsk)
|
||||||
*/
|
*/
|
||||||
void vtime_account_irq_enter(struct task_struct *tsk)
|
void vtime_account_irq_enter(struct task_struct *tsk)
|
||||||
{
|
{
|
||||||
struct thread_info *ti = task_thread_info(tsk);
|
|
||||||
u64 timer, system, system_scaled;
|
u64 timer, system, system_scaled;
|
||||||
|
|
||||||
timer = S390_lowcore.last_update_timer;
|
timer = S390_lowcore.last_update_timer;
|
||||||
|
@ -191,9 +185,9 @@ void vtime_account_irq_enter(struct task_struct *tsk)
|
||||||
time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
|
time_after64(jiffies_64, this_cpu_read(mt_scaling_jiffies)))
|
||||||
update_mt_scaling();
|
update_mt_scaling();
|
||||||
|
|
||||||
system = S390_lowcore.system_timer - ti->system_timer;
|
system = S390_lowcore.system_timer - tsk->thread.system_timer;
|
||||||
S390_lowcore.steal_timer -= system;
|
S390_lowcore.steal_timer -= system;
|
||||||
ti->system_timer = S390_lowcore.system_timer;
|
tsk->thread.system_timer = S390_lowcore.system_timer;
|
||||||
system_scaled = system;
|
system_scaled = system;
|
||||||
/* Do MT utilization scaling */
|
/* Do MT utilization scaling */
|
||||||
if (smp_cpu_mtid) {
|
if (smp_cpu_mtid) {
|
||||||
|
|
Loading…
Reference in New Issue