Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: John David Anglin <dave.anglin@bell.net>
Cc: linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH] parisc: Optimize switch_mm
Date: Wed, 26 Jul 2017 21:13:06 +0200	[thread overview]
Message-ID: <1e8a8db0-cf16-cdeb-27f8-284de4b5e9a9@gmx.de> (raw)
In-Reply-To: <0C9BC40B-9C2C-4058-BC0A-EAF1B017F537@bell.net>

On 26.07.2017 20:49, John David Anglin wrote:
> On 2017-07-26, at 2:02 PM, Helge Deller wrote:
> 
>> Instead I'd then suggest the patch below.
>> The if-clause in switch_mm_irqs_off() will then probably be optimized
>> away by the compiler.
>>
>> diff --git a/arch/parisc/include/asm/mmu_context.h b/arch/parisc/include/asm/mmu_context.h
>> index a812262..e4a6570 100644
>> --- a/arch/parisc/include/asm/mmu_context.h
>> +++ b/arch/parisc/include/asm/mmu_context.h
>> @@ -63,6 +63,9 @@ static inline void switch_mm(struct mm_struct *prev,
>> {
>> 	unsigned long flags;
>>
>> +	if (prev == next)
>> +		return;
>> +
>> 	local_irq_save(flags);
>> 	switch_mm_irqs_off(prev, next, tsk);
>> 	local_irq_restore(flags);
> 
> You are correct.  I missed the fact that switch_mm_irqs_off() is used by kernel/sched/core.c.
> 
> Maybe we should replace the "switch_mm_irqs_off(prev, next, tsk);" with the mtctl and load_context
> lines to ensure that the if-clause is optimized?

I think we should look at the generated assembly, and if it's not optimized away replace it with mtctl/load_context.

Helge

      reply	other threads:[~2017-07-26 19:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 21:31 [PATCH] parisc: Optimize switch_mm John David Anglin
2017-07-26 18:02 ` Helge Deller
2017-07-26 18:49   ` John David Anglin
2017-07-26 19:13     ` Helge Deller [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=1e8a8db0-cf16-cdeb-27f8-284de4b5e9a9@gmx.de \
    --to=deller@gmx.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@vger.kernel.org \
    /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