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 CE69628D8DA for ; Thu, 12 Mar 2026 09:10:58 +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=1773306658; cv=none; b=o3WkuQSYuDuWpW563Ngo5Jr+wYRiVRb9O9ma90xVtPa6Ad/j7i54V8/lAx0LAPbYvrkQ85TqrSo6IGXatfdRP0Gy9ZSbNanl3NRqqxFZ6tFOCxb3/Hie9uhqgmZwMrumv2giIhm4STYer3kr5xyvcL5cFbQlshae5W7trATEnYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773306658; c=relaxed/simple; bh=2IGrdEFg5B+lcOPX4/6iBaciXlB+vTGeAMbcDN/IjVk=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=YcPj4oR/Ba6O+hjfnZb+FiWDEpp6I/wJ5basYpQQRLQCJ3PjQgTQXiv92fFLLVJtjfkE8hTpse1sxjeompGk9A2E1IeiimEOo/OF5oB4wX+sjKghaisb9QZGxf1HoWvjymjrnyc4rQy+zTxVkU2TCe0oGoe5YlnKcZsyrjW/Rxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uReTo9Y+; 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="uReTo9Y+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9529BC4CEF7; Thu, 12 Mar 2026 09:10:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773306658; bh=2IGrdEFg5B+lcOPX4/6iBaciXlB+vTGeAMbcDN/IjVk=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=uReTo9Y+ostRIw5T2Pea4W64l8Bg8YSr5o0a7CJAJNzk14r6XuMZp3voETmvfLMz1 vGk7Johd1h3He+Oc03bLs9c11w5JYrVQ2rZSS73qiU7AfXoUjeH79sjNKE8Zx/Q0f0 xX8s1Lw77jGJ3XhicV7Y+RWDJHXq21fORao1cp8cB9NVsSA7Loa9ttd/CNdMER3P6U ywqBAdjZLff6N58Bb/C5umfl+TIBRmWGYmbKpQkDo55vFouEpI1CqgI0Avml6ov8z+ sY/m8wNiPhqYs2W+Yus2Ima9ChSkc6zH1UgML00voWc/dhIqeyxVLrX959uN3eLWHz 3JW+sAhq5C5cg== Message-ID: Date: Thu, 12 Mar 2026 10:10:54 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: vbabka@kernel.org Subject: Re: [PATCH] slab: remove alloc_full_sheaf() To: Qing Wang Cc: akpm@linux-foundation.org, cl@gentwo.org, hao.li@linux.dev, harry.yoo@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com, roman.gushchin@linux.dev References: <20260311-b4-slab-remove-alloc_full_sheaf-v1-1-c4c5bb587ae5@kernel.org> <20260312033105.593829-1-wangqing7171@gmail.com> Content-Language: en-US In-Reply-To: <20260312033105.593829-1-wangqing7171@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/12/26 04:31, Qing Wang wrote: > On Thu, 12 Mar 2026 at 02:22, "Vlastimil Babka (SUSE)" wrote: >> - if (!full) >> + if (refill_sheaf(s, empty, gfp | __GFP_NOMEMALLOC | __GFP_NOWARN)) { >> + /* >> + * we must be very low on memory so don't bother >> + * with the barn >> + */ >> + sheaf_flush_unused(s, empty); >> + free_empty_sheaf(s, empty); >> + >> return NULL; >> + } >> + >> + full = empty; >> + empty = NULL; > > 'empty = NULL' is meaningless since 'empty' is not used after here. Exactly, it's only for humans reading the code to make it explicit. And if someone tries to make a change that will start using empty, it will oops immediately instead of something more subtle. >> >> if (!local_trylock(&s->cpu_sheaves->lock)) >> goto barn_put; >> pcs = this_cpu_ptr(s->cpu_sheaves); >> >> /* >> - * If we are returning empty sheaf, we either got it from the >> - * barn or had to allocate one. If we are returning a full >> - * sheaf, it's due to racing or being migrated to a different >> - * cpu. Breaching the barn's sheaf limits should be thus rare >> - * enough so just ignore them to simplify the recovery. >> + * If we put any empty or full sheaf to the barn below, it's due to >> + * racing or being migrated to a different cpu. Breaching the barn's >> + * sheaf limits should be thus rare enough so just ignore them to >> + * simplify the recovery. >> */ >> >> if (pcs->main->size == 0) { > > LGTM. > > Reviewed-by: Qing Wang Thanks! > -- > Cheers, > Qing