From: "Arnd Bergmann" <arnd@arndb.de>
To: "Yangyu Chen" <cyy@cyyself.name>
Cc: "Christoph Hellwig" <hch@lst.de>,
"Alexander Potapenko" <glider@google.com>,
"Mike Frysinger" <vapier@gentoo.org>,
Linux-Arch <linux-arch@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] asm-generic: flush icache only when vma->vm_flags has VM_EXEC set
Date: Tue, 09 Jan 2024 17:43:00 +0100 [thread overview]
Message-ID: <1633a5e7-213e-4621-bdc5-5cc056da9d99@app.fastmail.com> (raw)
In-Reply-To: <tencent_13A0B6B4A3136E46CC448874232A9F956006@qq.com>
On Tue, Jan 9, 2024, at 15:45, Yangyu Chen wrote:
> For some ISAs like RISC-V, which may not support bus broadcast-based
> icache flushing instructions, it's necessary to send IPIs to all of the
> CPUs in the system to flush the icache. This process can be expensive for
> these ISAs and introduce disturbances during performance profiling.
> Limiting the icache flush to occur only when the vma->vm_flags has VM_EXEC
> can help minimize the frequency of these operations.
>
> Signed-off-by: Yangyu Chen <cyy@cyyself.name>
> ---
> include/asm-generic/cacheflush.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/cacheflush.h
> b/include/asm-generic/cacheflush.h
> index 84ec53ccc450..729d51536575 100644
> --- a/include/asm-generic/cacheflush.h
> +++ b/include/asm-generic/cacheflush.h
> @@ -102,7 +102,8 @@ static inline void flush_cache_vunmap(unsigned long
> start, unsigned long end)
> do { \
> instrument_copy_to_user((void __user *)dst, src, len); \
> memcpy(dst, src, len); \
> - flush_icache_user_page(vma, page, vaddr, len); \
> + if (vma->vm_flags & VM_EXEC) \
> + flush_icache_user_page(vma, page, vaddr, len); \
> } while (0)
> #endif
This is not my normal area of expertise, but I wonder if you can't
just do this the same way as alpha and openrisc by having the
condition in architecture specific code.
Arnd
prev parent reply other threads:[~2024-01-09 16:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 14:45 Yangyu Chen
2024-01-09 16:43 ` Arnd Bergmann [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=1633a5e7-213e-4621-bdc5-5cc056da9d99@app.fastmail.com \
--to=arnd@arndb.de \
--cc=cyy@cyyself.name \
--cc=glider@google.com \
--cc=hch@lst.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vapier@gentoo.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
all inboxes | Powered by JetHome®