Re: [PATCH v5 08/24] sched: Introduce per memory space current virtual cpu id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 03, 2022 at 04:03:43PM -0400, Mathieu Desnoyers wrote:

> diff --git a/kernel/fork.c b/kernel/fork.c
> index 08969f5aa38d..6a2323266942 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -1047,6 +1047,10 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node)
>  	tsk->reported_split_lock = 0;
>  #endif
>  
> +#ifdef CONFIG_SCHED_MM_VCPU
> +	tsk->mm_vcpu = -1;
> +	tsk->mm_vcpu_active = 0;
> +#endif
>  	return tsk;
>  
>  free_stack:

Note how the above hunk does exactly the same as the below thunk, and I
think they're even on the same code-path.

How about moving all of this to __sched_fork() or something?

> @@ -1579,6 +1586,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
>  
>  	tsk->mm = mm;
>  	tsk->active_mm = mm;
> +	sched_vcpu_fork(tsk);
>  	return 0;
>  }

> +void sched_vcpu_fork(struct task_struct *t)
> +{
> +	WARN_ON_ONCE((t->flags & PF_KTHREAD) || !t->mm);
> +	t->mm_vcpu = -1;
> +	t->mm_vcpu_active = 1;
> +}



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux