Re: [PATCH v2] docs/mm: describe set_memory() and set_direct_map() APIs
From: Kevin Brodsky
Date: Mon Sep 21 2026 - 09:04:46 EST
On 19/09/2026 12:43, Mike Rapoport (Microsoft) wrote:
> [...]
>
> +Modifying the kernel page tables
> +================================
> +
> +Except for the vmalloc area, the kernel page tables are mostly static. Still,
> +there are cases when the permissions of existing kernel mappings have to be
> +updated, for instance when a module is loaded and its text becomes read-only
> +and executable, or when a page is temporarily removed from the direct map to
> +reduce its exposure.
> +
> +There are two families of functions for this, both declared in
> +`include/linux/set_memory.h`:
> +
> +* `set_memory_*()` change permissions of an arbitrary kernel mapping. They
> + take a kernel virtual address and the number of pages.
> +
> +* `set_direct_map_*()` change permissions of the direct mapping of the page
> + frame represented by a `struct page`. They take a `struct page` pointer and
The new phrasing is a mouthful but at least should be accurate :) It
should probably say "range of page frames" or something like that though.
Looks good otherwise!
Reviewed-by: Kevin Brodsky <kevin.brodsky@xxxxxxx>