Re: [PATCH v6 1/3] mm: make persistent huge zero folio read-only
From: Dave Hansen
Date: Tue Aug 25 2026 - 12:29:14 EST
On 7/30/26 02:06, Xueyuan Chen wrote:
> + * Return: 0 on success or when direct-map permission changes are unsupported,
> + * or a negative errno on failure.
> + */
> +static inline int set_direct_map_ro_noflush(const void *addr,
> + unsigned long nr_pages)
> +{
> + return 0;
> +}
I think this is probably not the best API. First, it isn't consistent
with the other set_direct_map*() functions. Second, it's unusable for
things that matter. This would be a buggy function:
int this_must_succeed_for_security(unsigned long addr)
{
return set_direct_map_ro_noflush(addr, 1);
}
... despite looking just fine.
The best thing, IMNHO, is to return an actual error when the stub gets
used and have the callers deal with it (or not deal with it if they
don't care).