From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B0B93CCFB8 for ; Mon, 18 May 2026 06:53:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779087218; cv=none; b=l9FCuaRF3piTPGexXv0T8t0PJwC2GqGQQfLiE2ElRtVwexirQ6TSl2fwDAW6Gc04+KaOsBS0JqJ/h0ZvxjS/FhuwwUAnyNNxiXEvHY2l/PTX7PznDXC1XpB5/G3H5FwU9iWx5ooITrOrgZaSN1EvIVvaCwY8BeVTEUecVgSTnmM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779087218; c=relaxed/simple; bh=vWli/vR+RIARR6s+n9Haw5NKOwfocRPOqFQJCpL72dE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jzmklXJJX8DwVh4296Db3vRp0k5Zo+3esUZUCiU+QpkZZ2j7S7F/vgLrGcqBGKiZyx1oMOlDgwq/OG59SFz4XATE+dD4gA8jSy3A6Pv9BoTSrgYPtErzzsMYTxwwG+Nh00dEB6XVSp1Ju4+seZJZC8dLhtDWDW6YX7clHBqmURY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eMTkfE1M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eMTkfE1M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87AA8C2BCB7; Mon, 18 May 2026 06:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779087217; bh=vWli/vR+RIARR6s+n9Haw5NKOwfocRPOqFQJCpL72dE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=eMTkfE1MlEPQxdXxoYeJtR4dpNq3HqTgyugbnYucJrot6ZLZXlUEmAqVWU+2Pihu7 ZP4ydv2htTfvk12ZnivO1P4nyoq7E/pHBDet3srToax3bfT+kH2id3hY6zw8djR7Fx SjvfI3VroRrYuh7BH9fewaNJHKBmX3/BTMuvbQxqqKPVB1gA8V2+g6ODThXw6DJGKu U2Fmhiks9AId7/rgSk9Z3NndhyEOxoen41rRH5XGD/3s1cnGgG6G4lwckfXhHrlzPT lKhkxly1tVH8itrsoyBKe74A66Rawl1f9vgv+7Gd1z8EbX45JsXIqJ9RVuH0IgdUY+ EivoaUjI84XQQ== Message-ID: Date: Mon, 18 May 2026 15:53:33 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH RFC 6/8] mm/slab: allow changing sheaf_capacity at runtime Content-Language: en-US To: Yeoreum Yun Cc: Vlastimil Babka , Andrew Morton , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Suren Baghdasaryan , "Liam R. Howlett" References: <20260516-sheaves-tuning-v1-0-221aa3e1d829@kernel.org> <20260516-sheaves-tuning-v1-6-221aa3e1d829@kernel.org> From: "Harry Yoo (Oracle)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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