[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02041ab3-dcbd-9056-5571-48b84f527e42@redhat.com>
Date: Thu, 25 Feb 2021 19:25:58 +0100
From: David Hildenbrand <david@...hat.com>
To: Oscar Salvador <osalvador@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Hocko <mhocko@...nel.org>, VlastimilBabkavbabka@...e.cz,
pasha.tatashin@...een.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Anshuman Khandual <anshuman.khandual@....com>
Subject: Re: [PATCH v2 3/7] mm,memory_hotplug: Add kernel boot option to
enable memmap_on_memory
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 9bcc460e8bfe..95695483a622 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -42,7 +42,31 @@
> #include "internal.h"
> #include "shuffle.h"
>
> -static bool memmap_on_memory_enabled;
> +/*
> + * memory_hotplug.memmap_on_memory parameter
> + */
> +static bool memmap_on_memory_enabled __ro_after_init;
> +
> +static int memmap_on_memory_show(char *buffer, const struct kernel_param *kp)
> +{
> + return sprintf(buffer, "%s\n",
> + memmap_on_memory_enabled ? "on" : "off");
> +}
> +
> +static __meminit int memmap_on_memory_store(const char *val,
> + const struct kernel_param *kp)
> +{
> + /*
> + * Fail silently in case we cannot enable it due to platform constraints.
> + * User can always check whether it is enabled or not via /sys/module.
> + */
> + if (!IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE))
> + return 0;
> +
> + return param_set_bool(val, kp);
> +}
> +module_param_call(memmap_on_memory, memmap_on_memory_store,
> + memmap_on_memory_show, &memmap_on_memory_enabled, 0400);
Why are other users not allowed to read?
>
Might want to add a MODULE_PARM_DESC().
As we fail silently already, I'd keep it simple and use a
module_param(memmap_on_memory, bool, 0444);
moving the IS_ENABLED(CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE) into the
runtime check.
Apart from that LGTM.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists