Re: [PATCH v5 3/7] vfio/nvgrace-gpu: Add support for huge pfnmap

Jason Gunthorpe
2025-11-24T18:15:23Z

On Mon, Nov 24, 2025 at 11:59:22AM +0000, ankita@nvidia.com wrote:
> +static size_t nvgrace_gpu_aligned_devmem_size(size_t memlength)
> +{
> +#ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP
> + return ALIGN(memlength, PMD_SIZE);
> +#endif
> +#ifdef CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
> + return ALIGN(memlength, PUD_SIZE);
> +#endif
> + return memlength;
> +}

This needs a comment why it is OK to change the size up? Seems really
surprising (and wrong!). The commit message should explain it too.

Jason