From: Ming Wang <wangming01@loongson.cn>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] sched: there is no need to call switch_mm_irqs_off when sched between two user thread.
Date: Wed, 1 Jun 2022 14:45:06 +0800 [thread overview]
Message-ID: <a89053c6-ee36-e5a6-3c8f-c1cb64f54d93@loongson.cn> (raw)
In-Reply-To: <YpYqOC9Wx84oC2z5@hirez.programming.kicks-ass.net>
On 2022/5/31 下午10:46, Peter Zijlstra wrote:
> 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@loongson.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).
ok, thanks! And I will do it in architecture code.
prev parent reply other threads:[~2022-06-01 6:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-31 11:56 Ming Wang
2022-05-31 14:46 ` Peter Zijlstra
2022-06-01 6:45 ` Ming Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a89053c6-ee36-e5a6-3c8f-c1cb64f54d93@loongson.cn \
--to=wangming01@loongson.cn \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®