From: "Harry Yoo (Oracle)" <harry@kernel.org>
To: Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Vlastimil Babka <vbabka@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Hao Li <hao.li@linux.dev>, Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Suren Baghdasaryan <surenb@google.com>,
"Liam R. Howlett" <liam@infradead.org>
Subject: Re: [PATCH RFC 6/8] mm/slab: allow changing sheaf_capacity at runtime
Date: Mon, 18 May 2026 15:53:33 +0900 [thread overview]
Message-ID: <e4e6a1ac-e6cd-4d10-a0a8-20b875cb85c1@kernel.org> (raw)
In-Reply-To: <agl8p8WkngbBdyZH@e129823.arm.com>
On 5/17/26 5:30 PM, Yeoreum Yun wrote:
> Hi Harry,
Hi Yeoreum,
>> @@ -9111,7 +9309,39 @@ static ssize_t sheaf_capacity_show(struct kmem_cache *s, char *buf)
>> {
>> return sysfs_emit(buf, "%hu\n", s->sheaf_capacity);
>> }
>> -SLAB_ATTR_RO(sheaf_capacity);
>> +static ssize_t sheaf_capacity_store(struct kmem_cache *s,
>> + const char *buf, size_t length)
>> +{
>> + unsigned short capacity;
>> + int err;
>> +
>> + err = kstrtou16(buf, 10, &capacity);
>> + if (err)
>> + return err;
>> +
>> + if (!cache_supports_sheaves(s))
>> + return -EOPNOTSUPP;
>> +
>> + cpus_read_lock();
>> + mutex_lock(&slab_mutex);
>
> This patchset looks good to me.
Thanks :)
> However, I’m not sure why we need slab_mutex here, as using only
> flush_lock seems sufficient
The main reason why I used slab_mutex was because both disabling sheaves
and shrinking the cache acquires flush_lock.
> Some refactoring might be required, but it seems better to remove
> the acquisition of slab_mutex here.
With some refactoring, we could teach those functions that the caller
already acquired the lock and use flush_lock instead of slab_mutex.
However, it won't improve things much... both are global locks, and
I doubt that it would cause visible latency issues when creating new
slab caches.
I want to focus on refining the capacity change part for now.
--
Cheers,
Harry / Hyeonggon
next prev parent reply other threads:[~2026-05-18 6:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-15 16:24 [PATCH RFC 0/8] mm/slab: enable runtime sheaves tuning Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 1/8] mm/slab: do not store cache pointer in struct slab_sheaf Harry Yoo (Oracle)
2026-05-19 4:08 ` Hao Li
2026-05-15 16:24 ` [PATCH RFC 2/8] mm/slab: change sheaf_capacity type to unsigned short Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 3/8] mm/slab: track capacity per sheaf Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 4/8] mm/slab: allow bootstrap_cache_sheaves() to fail Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 5/8] mm/slab: rework cache_has_sheaves() to check immutable properties only Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 6/8] mm/slab: allow changing sheaf_capacity at runtime Harry Yoo (Oracle)
2026-05-17 8:30 ` Yeoreum Yun
2026-05-18 6:53 ` Harry Yoo (Oracle) [this message]
2026-05-15 16:24 ` [PATCH RFC 7/8] mm/slab: add pcs->lock lockdep assert when accessing the barn Harry Yoo (Oracle)
2026-05-15 16:24 ` [PATCH RFC 8/8] mm/slab: allow changing max_{full,empty}_sheaves at runtime Harry Yoo (Oracle)
2026-05-18 11:52 ` [PATCH RFC 0/8] mm/slab: enable runtime sheaves tuning Pedro Falcato
2026-05-20 4:35 ` Harry Yoo
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=e4e6a1ac-e6cd-4d10-a0a8-20b875cb85c1@kernel.org \
--to=harry@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@gentwo.org \
--cc=hao.li@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=yeoreum.yun@arm.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