On 29.11.2024 10:12, Luca Fancellu wrote:
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -165,6 +165,11 @@
> #define PGT_TYPE_INFO_INITIALIZER 0
> #endif
>
> +#ifdef CONFIG_STATIC_MEMORY
> +/* Flag saved when Xen is using the static heap feature (xen,static-heap) */
> +bool __ro_after_init static_heap;
> +#endif
I'm afraid I can't make sense of the last (parenthesized) part of the comment.
Presumably this is a DT-ism, but in a non-DT source file this then needs saying
one way or another.
> --- a/xen/include/xen/mm.h
> +++ b/xen/include/xen/mm.h
> @@ -72,6 +72,19 @@
>
> struct page_info;
>
> +#ifdef CONFIG_STATIC_MEMORY
> +extern bool static_heap;
> +#endif
> +
> +static inline bool using_static_heap(void)
> +{
> +#ifdef CONFIG_STATIC_MEMORY
> + return static_heap;
> +#else
> + return false;
> +#endif
> +}
Or, with less #ifdef-ary (and like we do elsewhere in similar situations):
#ifdef CONFIG_STATIC_MEMORY
extern bool static_heap;
#else
#define static_heap false
#endif
static inline bool using_static_heap(void)
{
return static_heap;
}
At which point it becomes questionable whether a wrapper function is
actually needed, and if not whether the variable itself could/should be
named using_static_heap then.
Jan