[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y2tyshbt+qgJXU9O@hirez.programming.kicks-ass.net>
Date: Wed, 9 Nov 2022 10:28:18 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
"Paul E . McKenney" <paulmck@...nel.org>,
Boqun Feng <boqun.feng@...il.com>,
"H . Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
linux-api@...r.kernel.org, Christian Brauner <brauner@...nel.org>,
Florian Weimer <fw@...eb.enyo.de>, David.Laight@...lab.com,
carlos@...hat.com, Peter Oskolkov <posk@...k.io>,
Alexander Mikhalitsyn <alexander@...alicyn.com>,
Chris Kennelly <ckennelly@...gle.com>
Subject: Re: [PATCH v5 08/24] sched: Introduce per memory space current
virtual cpu id
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;
> +}
Powered by blists - more mailing lists