From: Michal Hocko <mhocko@suse.com>
To: Aneesh Kumar K V <aneesh.kumar@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org, npiggin@gmail.com,
Vishal Verma <vishal.l.verma@intel.com>,
akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org,
Oscar Salvador <osalvador@suse.de>
Subject: Re: [PATCH v6 6/7] mm/memory_hotplug: Embed vmem_altmap details in memory block
Date: Thu, 27 Jul 2023 12:56:29 +0200 [thread overview]
Message-ID: <ZMJNXfKdKul8tRCO@dhcp22.suse.cz> (raw)
In-Reply-To: <b8068200-c692-79fc-3413-8dc05619e228@linux.ibm.com>
On Thu 27-07-23 15:02:12, Aneesh Kumar K V wrote:
> On 7/27/23 2:55 PM, Michal Hocko wrote:
> > On Thu 27-07-23 13:32:31, Aneesh Kumar K.V wrote:
> >> With memmap on memory, some architecture needs more details w.r.t altmap
> >> such as base_pfn, end_pfn, etc to unmap vmemmap memory. Instead of
> >> computing them again when we remove a memory block, embed vmem_altmap
> >> details in struct memory_block if we are using memmap on memory block
> >> feature.
> >>
> >> No functional change in this patch
> >>
> >> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> >> ---
> >> drivers/base/memory.c | 25 +++++++++++-------
> >> include/linux/memory.h | 8 ++----
> >> mm/memory_hotplug.c | 58 +++++++++++++++++++++++++++---------------
> >> 3 files changed, 55 insertions(+), 36 deletions(-)
> >>
> >> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> >> index b456ac213610..57ed61212277 100644
> >> --- a/drivers/base/memory.c
> >> +++ b/drivers/base/memory.c
> >> @@ -106,6 +106,7 @@ static void memory_block_release(struct device *dev)
> >> {
> >> struct memory_block *mem = to_memory_block(dev);
> >>
> >> + WARN_ON(mem->altmap);
> >
> > What is this supposed to catch? A comment would be handy so that we know
> > what to look at should it ever trigger.
> >
>
> I did add a comment where we clear the altmap in try_remove_memory(). I will also add
> more details here.
>
> + * Mark altmap NULL so that we can add a debug
> + * check on memblock free.
> */
>
> WARN_ON is an indication of memory leak because if we have mem->altmap != NULL
> then the allocated altmap is not freed . It also indicate that memblock got freed
> without going through the try_remove_memory().
I think it would be better to be explicit here (who should free up but
hasn't).
--
Michal Hocko
SUSE Labs
WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@suse.com>
To: Aneesh Kumar K V <aneesh.kumar@linux.ibm.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
npiggin@gmail.com, christophe.leroy@csgroup.eu,
Oscar Salvador <osalvador@suse.de>,
David Hildenbrand <david@redhat.com>,
Vishal Verma <vishal.l.verma@intel.com>
Subject: Re: [PATCH v6 6/7] mm/memory_hotplug: Embed vmem_altmap details in memory block
Date: Thu, 27 Jul 2023 12:56:29 +0200 [thread overview]
Message-ID: <ZMJNXfKdKul8tRCO@dhcp22.suse.cz> (raw)
In-Reply-To: <b8068200-c692-79fc-3413-8dc05619e228@linux.ibm.com>
On Thu 27-07-23 15:02:12, Aneesh Kumar K V wrote:
> On 7/27/23 2:55 PM, Michal Hocko wrote:
> > On Thu 27-07-23 13:32:31, Aneesh Kumar K.V wrote:
> >> With memmap on memory, some architecture needs more details w.r.t altmap
> >> such as base_pfn, end_pfn, etc to unmap vmemmap memory. Instead of
> >> computing them again when we remove a memory block, embed vmem_altmap
> >> details in struct memory_block if we are using memmap on memory block
> >> feature.
> >>
> >> No functional change in this patch
> >>
> >> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> >> ---
> >> drivers/base/memory.c | 25 +++++++++++-------
> >> include/linux/memory.h | 8 ++----
> >> mm/memory_hotplug.c | 58 +++++++++++++++++++++++++++---------------
> >> 3 files changed, 55 insertions(+), 36 deletions(-)
> >>
> >> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> >> index b456ac213610..57ed61212277 100644
> >> --- a/drivers/base/memory.c
> >> +++ b/drivers/base/memory.c
> >> @@ -106,6 +106,7 @@ static void memory_block_release(struct device *dev)
> >> {
> >> struct memory_block *mem = to_memory_block(dev);
> >>
> >> + WARN_ON(mem->altmap);
> >
> > What is this supposed to catch? A comment would be handy so that we know
> > what to look at should it ever trigger.
> >
>
> I did add a comment where we clear the altmap in try_remove_memory(). I will also add
> more details here.
>
> + * Mark altmap NULL so that we can add a debug
> + * check on memblock free.
> */
>
> WARN_ON is an indication of memory leak because if we have mem->altmap != NULL
> then the allocated altmap is not freed . It also indicate that memblock got freed
> without going through the try_remove_memory().
I think it would be better to be explicit here (who should free up but
hasn't).
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2023-07-27 10:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 8:02 [PATCH v6 0/7] Add support for memmap on memory feature on ppc64 Aneesh Kumar K.V
2023-07-27 8:02 ` Aneesh Kumar K.V
2023-07-27 8:02 ` [PATCH v6 1/7] mm/memory_hotplug: Simplify ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE kconfig Aneesh Kumar K.V
2023-07-27 8:02 ` [PATCH v6 2/7] mm/memory_hotplug: Allow memmap on memory hotplug request to fallback Aneesh Kumar K.V
2023-07-27 8:02 ` [PATCH v6 3/7] mm/memory_hotplug: Allow architecture to override memmap on memory support check Aneesh Kumar K.V
2023-07-27 8:02 ` [PATCH v6 4/7] mm/memory_hotplug: Support memmap_on_memory when memmap is not aligned to pageblocks Aneesh Kumar K.V
2023-07-27 8:02 ` Aneesh Kumar K.V
2023-07-27 9:23 ` Michal Hocko
2023-07-27 9:23 ` Michal Hocko
2023-07-27 9:27 ` Aneesh Kumar K V
2023-07-27 9:27 ` Aneesh Kumar K V
2023-07-27 10:55 ` Michal Hocko
2023-07-27 10:55 ` Michal Hocko
2023-07-27 8:02 ` [PATCH v6 5/7] powerpc/book3s64/memhotplug: Enable memmap on memory for radix Aneesh Kumar K.V
2023-07-27 8:02 ` Aneesh Kumar K.V
2023-07-27 8:02 ` [PATCH v6 6/7] mm/memory_hotplug: Embed vmem_altmap details in memory block Aneesh Kumar K.V
2023-07-27 8:02 ` Aneesh Kumar K.V
2023-07-27 9:25 ` Michal Hocko
2023-07-27 9:25 ` Michal Hocko
2023-07-27 9:32 ` Aneesh Kumar K V
2023-07-27 9:32 ` Aneesh Kumar K V
2023-07-27 10:56 ` Michal Hocko [this message]
2023-07-27 10:56 ` Michal Hocko
2023-07-27 11:17 ` David Hildenbrand
2023-07-27 11:17 ` David Hildenbrand
2023-07-27 8:02 ` [PATCH v6 7/7] mm/memory_hotplug: Enable runtime update of memmap_on_memory parameter Aneesh Kumar K.V
2023-07-27 9:26 ` Michal Hocko
2023-07-27 9:26 ` Michal Hocko
2023-07-27 11:18 ` David Hildenbrand
2023-07-27 11:18 ` David Hildenbrand
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=ZMJNXfKdKul8tRCO@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=osalvador@suse.de \
--cc=vishal.l.verma@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.