From: David Hildenbrand <david@redhat.com>
To: Sumanth Korikkar <sumanthk@linux.ibm.com>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Oscar Salvador <osalvador@suse.de>,
Michal Hocko <mhocko@suse.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
linux-s390 <linux-s390@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/memory_hotplug: fix memmap_on_memory sysfs value retrieval
Date: Wed, 10 Jan 2024 17:15:38 +0100 [thread overview]
Message-ID: <23bfe8cc-cffe-4832-a1fb-322f30f98f20@redhat.com> (raw)
In-Reply-To: <20240110140127.241451-1-sumanthk@linux.ibm.com>
On 10.01.24 15:01, Sumanth Korikkar wrote:
> The set_memmap_mode() function stores the kernel parameter memmap mode
> as an integer. However, the get_memmap_mode() function utilizes
> param_get_bool() to fetch the value as a boolean, leading to potential
> endianness issue. On Big-endian architectures, the memmap_on_memory is
> consistently displayed as 'N' regardless of its actual status.
>
> To address this endianness problem, the solution involves obtaining the
> mode as an integer. This adjustment ensures the proper display of the
> memmap_on_memory parameter, presenting it as one of the following
> options: Force, Y, or N.
>
> Fixes: 2d1f649c7c08 ("mm/memory_hotplug: support memmap_on_memory when memmap is not aligned to pageblocks")
> Suggested-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
> Cc: <stable@vger.kernel.org> # v6.6+
> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
> ---
> mm/memory_hotplug.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index b944e8bf1911..707027f69150 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -101,9 +101,11 @@ static int set_memmap_mode(const char *val, const struct kernel_param *kp)
>
> static int get_memmap_mode(char *buffer, const struct kernel_param *kp)
> {
> - if (*((int *)kp->arg) == MEMMAP_ON_MEMORY_FORCE)
> - return sprintf(buffer, "force\n");
> - return param_get_bool(buffer, kp);
> + int mode = *((int *)kp->arg);
> +
> + if (mode == MEMMAP_ON_MEMORY_FORCE)
> + return sprintf(buffer, "force\n");
> + return sprintf(buffer, "%c\n", mode ? 'Y' : 'N');
> }
I was wondering if we want to return "Y" instead of "force". But using
force seems more consistent.
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2024-01-10 16:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 14:01 Sumanth Korikkar
2024-01-10 16:15 ` David Hildenbrand [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23bfe8cc-cffe-4832-a1fb-322f30f98f20@redhat.com \
--to=david@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=sumanthk@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox