Skip to content

Commit

Permalink
riscv/mm: add arch hook arch_clear_hugepage_flags
Browse files Browse the repository at this point in the history
[ Upstream commit d8bf77a ]

With the PG_arch_1 we keep track if the page's data cache is clean,
architecture rely on this property to treat new pages as dirty with
respect to the data cache and perform the flushing before mapping the pages
into userspace.

This patch adds a new architecture hook, arch_clear_hugepage_flags,so that
architectures which rely on the page flags being in a particular state for
fresh allocations can adjust the flags accordingly when a page is freed
into the pool.

Fixes: 9e953cd ("riscv: Introduce huge page support for 32/64bit kernel")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
Link: https://lore.kernel.org/r/20221024094725.3054311-3-tongtiangen@huawei.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Tong Tiangen authored and gregkh committed Dec 31, 2022
1 parent 20d363d commit 339ca03
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/riscv/include/asm/hugetlb.h
Expand Up @@ -5,4 +5,10 @@
#include <asm-generic/hugetlb.h>
#include <asm/page.h>

static inline void arch_clear_hugepage_flags(struct page *page)
{
clear_bit(PG_dcache_clean, &page->flags);
}
#define arch_clear_hugepage_flags arch_clear_hugepage_flags

#endif /* _ASM_RISCV_HUGETLB_H */

0 comments on commit 339ca03

Please sign in to comment.