From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Muchun Song <muchun.song@linux.dev>
Cc: Muchun Song <songmuchun@bytedance.com>,
Oscar Salvador <osalvador@suse.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Christophe Leroy <chleroy@kernel.org>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
linux-mm@kvack.org, driver-core@lists.linux.dev,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-s390@vger.kernel.org
Subject: Re: [PATCH] drivers/base/memory: make memory block get/put explicit
Date: Tue, 12 May 2026 08:25:31 +0200 [thread overview]
Message-ID: <9171623c-4775-49e9-bc05-3ecf1a81c7bb@kernel.org> (raw)
In-Reply-To: <E9BB5FC5-0785-4162-8D1A-2A51C7250B34@linux.dev>
On 5/12/26 05:11, Muchun Song wrote:
>
>
>> On May 11, 2026, at 21:23, Muchun Song <muchun.song@linux.dev> wrote:
>>
>>
>>
>>>
>>> On 5/11/26 13:18, Muchun Song wrote:
>>>
>>> Better mention some of the other changes here, like removing find_memory_block().
>>
>> Will do.
>>
>>>
>>> [...]
>>>
>>>
>>> While at it, please drop the "extern".
>>
>> OK.
>>
>>>
>>>
>>> Would guards come in handy here?
>>
>> You mean to introduce something like:
>>
>> scoped_guard(memory_block, id) {
>> }
>>
>> Right? If yes, I will give it a try.
>
> Hi David,
Hi,
>
> Did I get that right?
I assume so, but it's indeed rather ugly. ... in particular the CLASS and
scoped_class() thingies are pretty intuitive.
I thought we could use guard()/scoped_guard(), but reading the details, it's
mostly for locks only.
There is only one users of scoped_class in the tree (overlayfs).
Maybe, if we would do this properly, we would actually provide our own wrappers,
like
MEMORY_BLOCK
scoped_memory_block
not even providing "memory_block_get", as that would be implicit.
Like
MEMORY_BLOCK(mem)(block_id); // the second () is confusing
scoped_memory_block(mem, block_id) {
}
But that requires more thought, and I don't really know what the best practice
is there ...
So thanks for trying, but let's leave it as is for now.
--
Cheers,
David
next prev parent reply other threads:[~2026-05-12 6:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 11:18 [PATCH] drivers/base/memory: make memory block get/put explicit Muchun Song
2026-05-11 11:27 ` Michal Hocko
2026-05-11 12:14 ` Oscar Salvador
2026-05-11 12:22 ` David Hildenbrand (Arm)
2026-05-11 13:23 ` Muchun Song
2026-05-12 3:11 ` Muchun Song
2026-05-12 6:25 ` David Hildenbrand (Arm) [this message]
2026-05-11 13:48 ` Lorenzo Stoakes
2026-05-12 6:52 ` Donet Tom
2026-05-12 7:25 ` Muchun Song
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=9171623c-4775-49e9-bc05-3ecf1a81c7bb@kernel.org \
--to=david@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=borntraeger@linux.ibm.com \
--cc=chleroy@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=hca@linux.ibm.com \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=ljs@kernel.org \
--cc=maddy@linux.ibm.com \
--cc=mhocko@suse.com \
--cc=mpe@ellerman.id.au \
--cc=muchun.song@linux.dev \
--cc=npiggin@gmail.com \
--cc=osalvador@suse.de \
--cc=rafael@kernel.org \
--cc=rppt@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=surenb@google.com \
--cc=svens@linux.ibm.com \
--cc=vbabka@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