From: Michael Ellerman <mpe@ellerman.id.au>
To: Matthew Wilcox <willy@infradead.org>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, npiggin@gmail.com
Subject: Re: [PATCH v2] powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes
Date: Thu, 02 Nov 2023 22:39:44 +1100 [thread overview]
Message-ID: <87bkccgz9b.fsf@mail.lhotse> (raw)
In-Reply-To: <ZTuV5GJ52IZE7mxu@casper.infradead.org>
Matthew Wilcox <willy@infradead.org> writes:
> On Tue, Oct 24, 2023 at 08:06:04PM +0530, Aneesh Kumar K.V wrote:
>> ptep++;
>> - pte = __pte(pte_val(pte) + (1UL << PTE_RPN_SHIFT));
>> addr += PAGE_SIZE;
>> + /*
>> + * increment the pfn.
>> + */
>> + pte = pfn_pte(pte_pfn(pte) + 1, pte_pgprot((pte)));
>
> when i looked at this, it generated shit code. did you check?
I didn't look ...
<goes and looks>
It's not super clear cut. There's some difference because pfn_pte()
contains two extra VM_BUG_ONs.
But with DEBUG_VM *off* the version using pfn_pte() generates *better*
code, or at least less code, ~160 instructions vs ~200.
For some reason the version using PTE_RPN_SHIFT seems to be byte
swapping the pte an extra two times, each of which generates ~8
instructions. But I can't see why.
I tried a few other things and couldn't come up with anything that
generated better code. But I'll keep poking at it tomorrow.
cheers
next prev parent reply other threads:[~2023-11-02 11:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-24 14:36 [PATCH v2] powerpc/mm: Avoid calling arch_enter/leave_lazy_mmu() in set_ptes Aneesh Kumar K.V
2023-10-27 9:46 ` Michael Ellerman
2023-10-27 10:50 ` Matthew Wilcox
2023-11-02 11:39 ` Michael Ellerman [this message]
2023-11-11 10:33 ` Christophe Leroy
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=87bkccgz9b.fsf@mail.lhotse \
--to=mpe@ellerman.id.au \
--cc=aneesh.kumar@linux.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).