linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Oscar Salvador <osalvador@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	<linux-cxl@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Will Deacon <will@kernel.org>, Jia He <justin.he@arm.com>,
	Mike Rapoport <rppt@linux.ibm.com>, <linuxarm@huawei.com>,
	<catalin.marinas@arm.com>, <Anshuman.Khandual@arm.com>,
	Yuquan Wang <wangyuquan1236@phytium.com.cn>,
	Lorenzo Pieralisi <lpieralisi@kernel.org>,
	James Morse <james.morse@arm.com>
Subject: Re: [RFC PATCH 8/8] HACK: mm: memory_hotplug: Drop memblock_phys_free() call in try_remove_memory()
Date: Thu, 30 May 2024 13:14:41 +0100	[thread overview]
Message-ID: <20240530131441.000020bd@Huawei.com> (raw)
In-Reply-To: <ZlhP6aMUOjx_EziA@localhost.localdomain>

On Thu, 30 May 2024 12:07:37 +0200
Oscar Salvador <osalvador@suse.com> wrote:

> On Wed, May 29, 2024 at 06:12:36PM +0100, Jonathan Cameron wrote:
> > I'm not sure what this is balancing, but it if is necessary then the reserved
> > memblock approach can't be used to stash NUMA node assignments as after the
> > first add / remove cycle the entry is dropped so not available if memory is
> > re-added at the same HPA.  
> 
> It is balancing previously allocated memory which was allocated via
> memblock_phys_alloc{_range,try_nid}.
> memblock_phys_alloc_try_nid() is who does the heavy-lifting, and also calls
> kmemleak_alloc_phys() to make kmemleak aware of that memory.

Thanks Oscar,

I'm struggling to find the call path that does that for the particular range being
released.

There are some calls to allocate node data but for small amounts of data
whereas I think this call is removing the full range of the hot removed memory.
Is the intent just to get rid of the node data related reserved memblock if
it happens to be in the memory removed?  If so feels like the call should
really be targetting just that.

> 
> A quick idea that came to me is:
> I think that it should be possible 1) create a new memory_block flag
> (check 'enum memblock_flags') and 2) flag the range you want with this
> range (check memblock_setclr_flag()) with a function like
> memblock_reserved_mark_{yourflag}.
> 
> Then, in memblock_phys_free() (or down the path) we could check for that flag,
> and refuse to proceed if it is set.

I had tried a flag in the main memblock rather than using the reserved memblock
a while back and that was horribly invasive so I got a bit scared of touching
those flags. One used only in the reserved memblock might work
to bypass the removal of the reserved memblocks but carry out everything
else that call is intended to do. I'm still sketchy on what I'm bypassing
though!

Thanks,

Jonathan

> 
> Would that work?
> I am not sure, but you might need to 
> 
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-05-30 12:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 17:12 [RFC PATCH 0/8] arm64/memblock: Handling of CXL Fixed Memory Windows Jonathan Cameron
2024-05-29 17:12 ` [RFC PATCH 1/8] arm64: numa: Introduce a memory_add_physaddr_to_nid() Jonathan Cameron
2024-08-01  7:50   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 2/8] arm64: memblock: Introduce a generic phys_addr_to_target_node() Jonathan Cameron
2024-08-01  7:52   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 3/8] mm: memblock: Add a means to add to memblock.reserved Jonathan Cameron
2024-08-01  7:53   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 4/8] arch_numa: Avoid onlining empty NUMA nodes Jonathan Cameron
2024-08-01  7:53   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 5/8] arch_numa: Make numa_add_memblk() set nid for memblock.reserved regions Jonathan Cameron
2024-08-01  7:54   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 6/8] arm64: mm: numa_fill_memblks() to add a memblock.reserved region if match Jonathan Cameron
2024-08-01  7:54   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 7/8] acpi: srat: cxl: Skip zero length CXL fixed memory windows Jonathan Cameron
2024-08-01  7:55   ` Yuquan Wang
2024-05-29 17:12 ` [RFC PATCH 8/8] HACK: mm: memory_hotplug: Drop memblock_phys_free() call in try_remove_memory() Jonathan Cameron
2024-05-30 10:07   ` Oscar Salvador
2024-05-30 12:14     ` Jonathan Cameron [this message]
2024-05-31  7:49   ` David Hildenbrand
2024-05-31  9:48     ` Jonathan Cameron
2024-05-31  9:55       ` David Hildenbrand
2024-06-06 15:44         ` Mike Rapoport
2024-06-03  7:57     ` Mike Rapoport
2024-06-03  9:14       ` David Hildenbrand
2024-06-03 10:43         ` Mike Rapoport
2024-06-03 20:53           ` David Hildenbrand
2024-06-04  9:35             ` Mike Rapoport
2024-06-04  9:39               ` David Hildenbrand
2024-06-05  8:00                 ` Mike Rapoport
2024-06-05  8:23                   ` 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=20240530131441.000020bd@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Anshuman.Khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=james.morse@arm.com \
    --cc=justin.he@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=lpieralisi@kernel.org \
    --cc=osalvador@suse.com \
    --cc=rppt@linux.ibm.com \
    --cc=sudeep.holla@arm.com \
    --cc=wangyuquan1236@phytium.com.cn \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).