From: Andrew Morton <akpm@linux-foundation.org>
To: maobibo <maobibo@loongson.cn>
Cc: "Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
"Huacai Chen" <chenhc@lemote.com>,
"Paul Burton" <paulburton@kernel.org>,
"Dmitry Korotin" <dkorotin@wavecomp.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Stafford Horne" <shorne@gmail.com>,
"Steven Price" <steven.price@arm.com>,
"Anshuman Khandual" <anshuman.khandual@arm.com>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
"Mike Rapoport" <rppt@linux.ibm.com>,
"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
"Maciej W. Rozycki" <macro@wdc.com>,
linux-mm@kvack.org, "David Hildenbrand" <david@redhat.com>
Subject: Re: [PATCH v4 2/4] mm/memory.c: Update local TLB if PTE entry exists
Date: Wed, 20 May 2020 17:54:46 -0700 [thread overview]
Message-ID: <20200520175446.11068e9e81da493a8e120601@linux-foundation.org> (raw)
In-Reply-To: <e9cd1d61-c475-9b13-fd48-3ff886c74797@loongson.cn>
On Wed, 20 May 2020 14:39:13 +0800 maobibo <maobibo@loongson.cn> wrote:
> > I'm still worried about the impact on other architectures. The
> > additional update_mmu_cache() calls won't occur only when multiple
> > threads are racing against the same page, I think? For example,
> > insert_pfn() will do this when making a read-only page a writable one.
> How about defining ptep_set_access_flags function like this on mips system?
> which is the same on riscv platform.
>
> static inline int ptep_set_access_flags(struct vm_area_struct *vma,
> unsigned long address, pte_t *ptep,
> pte_t entry, int dirty)
> {
> if (!pte_same(*ptep, entry))
> set_pte_at(vma->vm_mm, address, ptep, entry);
> /*
> * update_mmu_cache will unconditionally execute, handling both
> * the case that the PTE changed and the spurious fault case.
> */
> return true;
> }
>
hm, it seems a bit abusive - ptep_set_access_flags() is supposed to
return true if the pte changed, and that isn't the case here.
I suppose we could run update_mmu_cache() directly from
ptep_set_access_flags() if we're about to return false, but that
doesn't seem a lot nicer?
> > Would you have time to add some instrumentation into update_mmu_cache()
> > (maybe a tracepoint) and see what effect this change has upon the
> > frequency at which update_mmu_cache() is called for a selection of
> > workloads? And add this info to the changelog to set minds at ease?
>
> OK, I will add some instrumentation data in the changelog.
Well, if this testing shows no effect as you expect, perhaps we can
leave the code as-is.
next prev parent reply other threads:[~2020-05-21 0:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 10:03 [PATCH v4 1/4] MIPS: Do not flush tlb page when updating PTE entry Bibo Mao
2020-05-19 10:03 ` [PATCH v4 2/4] mm/memory.c: Update local TLB if PTE entry exists Bibo Mao
2020-05-20 1:26 ` Andrew Morton
2020-05-20 6:39 ` maobibo
2020-05-21 0:54 ` Andrew Morton [this message]
2020-05-19 10:03 ` [PATCH v4 3/4] mm/memory.c: Add memory read privilege on page fault handling Bibo Mao
2020-05-20 1:30 ` Andrew Morton
2020-05-20 8:22 ` maobibo
2020-05-19 10:03 ` [PATCH v4 4/4] MIPS: mm: add page valid judgement in function pte_modify Bibo Mao
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=20200520175446.11068e9e81da493a8e120601@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=chenhc@lemote.com \
--cc=david@redhat.com \
--cc=dkorotin@wavecomp.com \
--cc=f4bug@amsat.org \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=macro@wdc.com \
--cc=maobibo@loongson.cn \
--cc=paulburton@kernel.org \
--cc=rppt@linux.ibm.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=shorne@gmail.com \
--cc=steven.price@arm.com \
--cc=tsbogend@alpha.franken.de \
/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