[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1633a5e7-213e-4621-bdc5-5cc056da9d99@app.fastmail.com>
Date: Tue, 09 Jan 2024 17:43:00 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Yangyu Chen" <cyy@...self.name>
Cc: "Christoph Hellwig" <hch@....de>,
"Alexander Potapenko" <glider@...gle.com>,
"Mike Frysinger" <vapier@...too.org>,
Linux-Arch <linux-arch@...r.kernel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] asm-generic: flush icache only when vma->vm_flags has VM_EXEC set
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@...self.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
Powered by blists - more mailing lists