lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 31 May 2022 16:46:16 +0200 From: Peter Zijlstra <peterz@...radead.org> To: Ming Wang <wangming01@...ngson.cn> Cc: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>, Valentin Schneider <vschneid@...hat.com>, linux-kernel@...r.kernel.org Subject: Re: [PATCH v1] sched: there is no need to call switch_mm_irqs_off when sched between two user thread. On Tue, May 31, 2022 at 07:56:41PM +0800, Ming Wang wrote: > When condition (prev->active_mm == next->mm && !prev->mm) is met, > the situation is as follows: > > user thread -> user thread > > There is not need switch_mm when sched between two user thread. > Because they share the mm_struct. This can provide better > performance when testing UnixBench. > > Signed-off-by: Ming Wang <wangming01@...ngson.cn> > --- > kernel/sched/core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 696c649..9d7f6fb 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -5099,7 +5099,8 @@ asmlinkage __visible void schedule_tail(struct task_struct *prev) > * case 'prev->active_mm == next->mm' through > * finish_task_switch()'s mmdrop(). > */ > - switch_mm_irqs_off(prev->active_mm, next->mm, next); > + if ((prev->active_mm != next->mm) || (!prev->mm)) > + switch_mm_irqs_off(prev->active_mm, next->mm, next); I think this needs to be inside switch_mm(). Architectures are free to play silly games with what the current active mm is (and iirc x86 actually does this).
Powered by blists - more mailing lists