[PATCH v2 7/7] ARM: implement support for vmap'ed stacks

Nicolas Pitre nico at fluxnic.net
Mon Oct 18 08:33:47 PDT 2021


On Mon, 18 Oct 2021, Ard Biesheuvel wrote:

> +void arch_sync_kernel_mappings(unsigned long start, unsigned long end)
> +{
> +	if (start > VMALLOC_END || end < VMALLOC_START)
> +		return;
> +
> +	/*
> +	 * This hooks into the core vmalloc code to receive notifications of
> +	 * any PMD level changes that have been made to the kernel page tables.
> +	 * This means it should only be triggered once for every MiB worth of
> +	 * vmalloc space, given that we don't support huge vmalloc/vmap on ARM,
> +	 * and that kernel PMD level table entries are rarely (if ever)
> +	 * updated.
> +	 *
> +	 * This means that the counter is going to max out at ~250 for the
> +	 * typical case. If it overflows, something entirely unexpected has
> +	 * occurred so let's throw a warning if that happens.
> +	 */
> +	WARN_ON(++init_mm.context.vmalloc_seq == UINT_MAX);

I don't understand the logic here. Yes, changes are not that frequent 
and this is pretty unlikely to ever wrap. But given an infinite run 
time, it could wrap and that woule be OK.


Nicolas



More information about the linux-arm-kernel mailing list