From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A61C33F6C35 for ; Mon, 18 May 2026 11:52:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779105159; cv=none; b=jzdDvFPoZLHmzkhb7IndD7ElpqOdJt+4LMZQOfysGzB27GuJ2Lq5dewgKNfrFYjCOlflk6x73rAtHxz+XzOES0TqumnwE2jvjIKDvmdIAQmm7FZ4FhMfuC44vAQbgyLlloIHHI7wuArhw3zE8BtT39wiV4Q12e6E+xe5tJInDMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779105159; c=relaxed/simple; bh=yDfowg6OYepYcPrHvZ2/DDF7Ch6s003CfQJk+nogXqQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LAH0lzqBEoaQpoyk7nAJwk1EbBiAy9pJDBq9tzbOFaCe99us0CwjTjcZbtPPSFZvmZMTmvtUZjkyv/UFEr5nm+v2bNNXJb3yu3T6FCQGHUdmt7JkcBT8TZsfNkXsgiHylqCoZZMxmS4k0am3b/Ww/yUhsHakBAP8uzVKjsKNMJ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Ce7RpLEr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=XZjGzMN3; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Ce7RpLEr; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=XZjGzMN3; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Ce7RpLEr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="XZjGzMN3"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Ce7RpLEr"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="XZjGzMN3" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B3DAD5C8EE; Mon, 18 May 2026 11:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1779105155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=04M/+O0JITx85kpF3ZIDQqZ/0fzW3SP3af9yns+yu7M=; b=Ce7RpLEr+K4Ce0efs1BZPONzJ2Vx6Uh6jxgbtlw4H2ESFQCLoF6IGCpW3fP4FEn9F5mWaV YoFzcqEMCG+lPT0mOosCPoHRR8dHTaAGrjwjWL2/Ef4ECEPkqfEAVhHj60BUXDdrTwjLjX NEinJ15kAUs441BoKyukU6RPex1cLiY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1779105155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=04M/+O0JITx85kpF3ZIDQqZ/0fzW3SP3af9yns+yu7M=; b=XZjGzMN3NZn5eWCwJ727QlHeuapnpjdU6juC5fRoAZdozpxIUEQPYl5ePHxFk40yjxlPd9 n0rvqUUJJBxtPvAA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1779105155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=04M/+O0JITx85kpF3ZIDQqZ/0fzW3SP3af9yns+yu7M=; b=Ce7RpLEr+K4Ce0efs1BZPONzJ2Vx6Uh6jxgbtlw4H2ESFQCLoF6IGCpW3fP4FEn9F5mWaV YoFzcqEMCG+lPT0mOosCPoHRR8dHTaAGrjwjWL2/Ef4ECEPkqfEAVhHj60BUXDdrTwjLjX NEinJ15kAUs441BoKyukU6RPex1cLiY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1779105155; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=04M/+O0JITx85kpF3ZIDQqZ/0fzW3SP3af9yns+yu7M=; b=XZjGzMN3NZn5eWCwJ727QlHeuapnpjdU6juC5fRoAZdozpxIUEQPYl5ePHxFk40yjxlPd9 n0rvqUUJJBxtPvAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8D775593A8; Mon, 18 May 2026 11:52:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Pt/kIYP9CmrsbgAAD6G6ig (envelope-from ); Mon, 18 May 2026 11:52:35 +0000 Date: Mon, 18 May 2026 13:52:34 +0200 From: Pedro Falcato To: "Harry Yoo (Oracle)" 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" Subject: Re: [PATCH RFC 0/8] mm/slab: enable runtime sheaves tuning Message-ID: References: <20260516-sheaves-tuning-v1-0-221aa3e1d829@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260516-sheaves-tuning-v1-0-221aa3e1d829@kernel.org> X-Spam-Level: X-Spamd-Result: default: False [-3.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_SEVEN(0.00)[11]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-Spam-Score: -3.80 On Sat, May 16, 2026 at 01:24:24AM +0900, Harry Yoo (Oracle) wrote: > Background > ========== > > Sheaves were introduced in v6.18, and starting from v7.0, they are > enabled for all slab caches (except for kmem_cache{,_node}). In the > pre-sheaves era, there was a cpu_partial parameter to tune the number > of objects cached per CPU. However, sheaves don't have an equivalent > and the sheaf capacity is determined in the kernel code. What semantic do you need from this? > > The goal is to allow tuning sheaves at runtime by the next LTS. > > Overview > ======== > > This patchset does two main things: > > 1. Make the sheaf_capacity sysfs attribute writable so that the number > of objects cached per CPU can be changed at runtime, and > > 2. Expose MAX_FULL_SHEAVES and MAX_EMPTY_SHEAVES as sysfs attributes > rather than constants, so that users can tune them. > > Measuring the performance impact of these tunables is TBD. > > Roughly, the sequence to change sheaf_capacity is as follows: > > 1. Disable sheaves. Make all online CPUs replace their main sheaves > with the bootstrap sheaf under local_lock and wait for completion. This is extremely destabilizing performance-wise, were I to guess. > > 2. Wait for all in-flight RCU callbacks to be processed. and this too. > > 3. Flush and free all existing sheaves. > > 4. Re-enable sheaves with a new capacity. > > Challenges > ========== > > 1. Allocations and frees can happen concurrently at any point between > these steps, and we cannot introduce heavyweight synchronization > mechanisms on the fastpath. > > 2. Currently, cache_has_sheaves() checks whether a cache has sheaves. > This works now because sheaves cannot be enabled or disabled once > the cache is created. > > The question "Does this cache has sheaves?" should be split into > "Does this cache support sheaves?" and "Does this CPU actually has > sheaves enabled right now?". > > 3. Once the sheaf capacity update is complete, no sheaf with stale > capacity must remain. Why? I don't see a huge problem with having multiple sheaves with different capacities, as long as you adequately, opportunistically kill the sheaves if they don't have the desired size (say, once a sheaf is fully empty). -- Pedro