Re: [RFC PATCH 3/4] mm/page_alloc: introduce __GFP_PTE_MAPPED flag to allocate pte-mapped pages

From: Vlastimil Babka
Date: Tue Aug 24 2021 - 12:13:03 EST


On 8/23/21 15:25, Mike Rapoport wrote:
> @@ -3283,5 +3283,7 @@ static inline int seal_check_future_write(int seals, struct vm_area_struct *vma)
> return 0;
> }
>
> +void pte_mapped_cache_init(void);
> +
> #endif /* __KERNEL__ */
> #endif /* _LINUX_MM_H */
> diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h
> index 973fd731a520..4faf8c542b00 100644
> --- a/include/linux/pageblock-flags.h
> +++ b/include/linux/pageblock-flags.h
> @@ -21,6 +21,8 @@ enum pageblock_bits {
> /* 3 bits required for migrate types */
> PB_migrate_skip,/* If set the block is skipped by compaction */
>
> + PB_pte_mapped, /* If set the block is mapped with PTEs in direct map */
> +
> /*
> * Assume the bits will always align on a word. If this assumption
> * changes then get/set pageblock needs updating.

You have broken this assumption :)
> @@ -536,7 +558,7 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
> unsigned long bitidx, word_bitidx;
> unsigned long old_word, word;
>
> - BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4);
> + BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 5);

This is not sufficient to satisfy the "needs updating" part. We would now need
NR_PAGEBLOCK_BITS == 8.