Thread (10 messages) 10 messages, 7 authors, 2026-05-12

Re: [PATCH] drivers/base/memory: make memory block get/put explicit

flat view

From: Muchun Song <muchun.song@linux.dev>
Date: 2026-05-12 07:25:53
Also in: driver-core, linux-mm, linux-s390, lkml

On May 12, 2026, at 14:52, Donet Tom [off-list ref] wrote:

On 5/11/26 4:48 PM, Muchun Song wrote:
quoted
Rename the memory block lookup helper to make the acquired reference
explicit, add memory_block_put() to wrap put_device(), and collapse the
redundant section-number wrapper into a single block-id based lookup
interface.

This makes it clearer to callers that a successful lookup holds a
reference that must be dropped, reducing the chance of forgetting the
matching put and leaking the memory block device reference.

Link: https://lore.kernel.org/linux-mm/7887915D-E598-42B3-9AFE-BFFBACE8DE2D@linux.dev/#t (local)
Signed-off-by: Muchun Song <redacted>
---
 .../platforms/pseries/hotplug-memory.c        | 14 ++-----
 drivers/base/memory.c                         | 38 +++++++------------
 drivers/base/node.c                           |  4 +-
 drivers/s390/char/sclp_mem.c                  | 17 ++++-----
 include/linux/memory.h                        |  7 +++-
 mm/memory_hotplug.c                           |  5 +--
 6 files changed, 35 insertions(+), 50 deletions(-)


Hi

I did some basic DLPAR memory add/remove tests on PowerPC with this patch, and it is working fine.

Initial memory
==============
[]# cat /proc/meminfo |grep -i MemTotal
MemTotal:       205169920 kB

After Add
=========
[]# cat /proc/meminfo |grep -i MemTotal
MemTotal:       247112960 kB

After Remove
============
[]# cat /proc/meminfo |grep -i MemTotal
MemTotal:       173729024 kB
[]#

Tested-by: Donet Tom <redacted>

Really thanks for your testing.

Thanks,
Muchun.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help