Re: [PATCH v2 08/20] KVM: s390: KVM page table management functions: allocation

Heiko Carstens
2025-09-16T16:27:08Z

On Wed, Sep 10, 2025 at 08:07:34PM +0200, Claudio Imbrenda wrote:
> Add page table management functions to be used for KVM guest (gmap)
> page tables.
>
> This patch adds the boilerplate and functions for the allocation and
> deallocation of DAT tables.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> arch/s390/kvm/Makefile | 1 +
> arch/s390/kvm/dat.c | 91 ++++++++++++++++++++++++++++++++++++++
> arch/s390/kvm/dat.h | 4 ++
> arch/s390/mm/page-states.c | 1 +
> 4 files changed, 97 insertions(+)
> create mode 100644 arch/s390/kvm/dat.c

...

> +static inline struct page_table *dat_alloc_pt_noinit(void)
> +{
> + struct page *page;
> + void *virt;
> +
> + page = alloc_pages(GFP_ATOMIC, 0);
> + if (!page)
> + return NULL;
> +
> + virt = page_to_virt(page);
> + __arch_set_page_dat(virt, 1);
> + return virt;
> +}

Is GFP_ATOMIC a typo, and this should have been GFP_KERNEL?

Otherwise I would guess this will cause problems in the future when
under memory pressure allocating guest page tables fails easily,
while before this change such allocations never failed.