From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E6A5C4332F for ; Tue, 31 Oct 2023 09:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6CE56B02BE; Tue, 31 Oct 2023 05:50:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF6156B02BF; Tue, 31 Oct 2023 05:50:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BD696B02C3; Tue, 31 Oct 2023 05:50:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 866606B02BE for ; Tue, 31 Oct 2023 05:50:22 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 538EFA0B15 for ; Tue, 31 Oct 2023 09:50:22 +0000 (UTC) X-FDA: 81405286284.04.052CE1A Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf27.hostedemail.com (Postfix) with ESMTP id 420B74001E for ; Tue, 31 Oct 2023 09:50:20 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ozFrpdZd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=nRTQoFQC; dmarc=none; spf=pass (imf27.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698745820; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; b=Up/5OhX0tjuCjOaGrm+e9cFeBoOvcIK+JXboyGHsLp0Pm9hNGkCBWwjDJcW+DzmBAOPEgK FO/seH1YQcWQ0SgVJUZSyKpbtrnLCa36U1vGoSOq0onwkd1s6ofT+AkBhVo34tY1lfMFi9 wKrvOrHzWz93LxBvW0aTarnCPAj1+Yo= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ozFrpdZd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=nRTQoFQC; dmarc=none; spf=pass (imf27.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698745820; a=rsa-sha256; cv=none; b=XLvz8lpP+DbPWiuTxOAse71+ESk+ai/soNNuSkIuzoMulLwxHwWRbkTnp794ACmcg/qAZ2 jxkbt50hNDZQGBu0CEAfL0If7RIY+S5haC4hKVbvG68ocmuSCUakyx9XjrheRIdVqwg7WF Mzkivqj+mWf+EMYoaOZk1m1AaQVWDOw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C8CC81F38C; Tue, 31 Oct 2023 09:50:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1698745817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; b=ozFrpdZdqvIodxUouCteImh+vwVdBdUAjxTpTMC6G44Bm+oX2sK6BFcCxHxb/QrLkj5fvL IRBMj3aughr2iO67uezAtmzahtbNf4hd6q9f02wrxIBrcoSvbbuVxq2Bhn3kd44Z+89B5l liHbRUYYQj1UvAbGByn5F8nbjqtR5/Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1698745817; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wmDB3ZoDEHTn9+Fzo12LCAKVuElxwSgtEkkn5Gsrlpw=; b=nRTQoFQCzDbSNuEj/BqAmcyG++PhOUY388ZS85rAY0YlzAlYmN/jAHTtjy7lLOGSSQUbbG PaWn7jR/4rYR+fCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 95104138EF; Tue, 31 Oct 2023 09:50:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id A1WVI9nNQGW4bwAAMHmgww (envelope-from ); Tue, 31 Oct 2023 09:50:17 +0000 Message-ID: <6257318a-3d39-ccdf-a85f-dc1008a8f425@suse.cz> Date: Tue, 31 Oct 2023 10:50:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFC PATCH v3 6/7] slub: Delay freezing of partial slabs Content-Language: en-US To: chengming.zhou@linux.dev, cl@linux.com, penberg@kernel.org Cc: rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou References: <20231024093345.3676493-1-chengming.zhou@linux.dev> <20231024093345.3676493-7-chengming.zhou@linux.dev> From: Vlastimil Babka In-Reply-To: <20231024093345.3676493-7-chengming.zhou@linux.dev> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 420B74001E X-Stat-Signature: 15r8k8w33h9tzc88usr5jpzysua6zr11 X-HE-Tag: 1698745820-537688 X-HE-Meta: U2FsdGVkX19y7JUerKVDSauBiCzuYze58ePsaOJhaEJq5mhWL/KSm+AB78mJrtyoZ7Cp63BiyDzqYUGy1ohBv2Yu1cbSn1Xz8pHvADMHEHe/pO9Y1UBJyX4tlt/BYs9Ja7i1L8BatRiWcH6FRz+06zOCp2Oos5hGJ+YuNfY8AnDkE6S/Jzk180ZEaQUP2gcFYNZFuSSCvFHwMBljdFE230+81ASUpkXTLHhAMcerfHcMNEqcT6Ek1ydtexYwy11zddNodGoZyJZj2mMlrAlF1zZrYtfXYHDLl3OuJD2/Pvv1masd2YB9hJkvmK5rZSkuOWSs5uDpG11vN0czvZ1lwcrzt2h0Dr4XmpfdxyK24ox7GkDV5XBgubodYbWwcI+AyFNsLdKcnRtdnb4mOJJ9AiwcvE4yBVzgr9qKsQzB2dysg4xzyrh0VUhnEPZ2uo+hWH9NE9VUQ0pyGpKSPOlmjtgS5i/qjcdKySLSgPqXIKfLYby0ZXI6GlzVRNbsU9Cmj16kUQVav4KMquqmalfWHLUbcpyej2rJZYxrHgxpmI4Nv2irdI/T4NncbL0NL1F59Mv1/Jt/YbRqXCa0C/FFY1EvmDa/bbVgb1Ltz0e4vIhVsk06wKOAVmUdn2/DPVsW0n7kl4Qm7/Hg71jZLb65S0yfwQPRHlskGAPIRqB465m5fXjK9NN19Hk1MHAAnSmMfa2aWAe7KvUO0zMkKUqn2x/iICAoDyYN6UpWYAbgHmfKS6+ASFx3831BOSHAbCRGbz3rLLUPXON7498F+89PyYXuwDxMqppz+xMDYO3pl9Gf/mIh67ChRKM6nYm91FzIoQGRd01iuncCe2EX5InZ77eieWX+r6YlgQ1vM9vbEsbm/aR0hAGMKZ4xixnaOYmVSzhIynhlj5njwhnEgSdxXgwNJDGyeBYMAxNHzqOZFNljwacfE/XJHCoTQtbCh8x7XSm5Zj8isnwLy/sYnYJ 4Op/2Dm2 wK4GrwiMBw2nEt+u/uOHlaEJUxAxH1MtovAf9Txjlg3XoYh/vfK7EBEZIu+Fx074cCXHl5TYJ4D11CSX8ulsRp1G2GxcX5ujM/FzQ/BgHfgwffDMdpxhw6NZldG8DDCSDHWfvWcNOFnKEHR4lT3L9EwSjoE60jEYoewOUkUbgOtRxH+uBvPC7M9+ytxFI50trRs0mCEBWLOaAdT1KxEjsb6wAfx9EVq1QqZg2wdKjY6IQZI0GBAcD2E2XI9ERojeCZr3v9Nnb6/sl4/G6+tnsB1Tsm1gMtcRdurHue0M0zPx14BuXEFc6+dtmyz/ld6cWdgodfP/Xamj2DzcVB2pkxPJmhfXNOVimMv8XVtLQHO7EDf4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 10/24/23 11:33, chengming.zhou@linux.dev wrote: > From: Chengming Zhou > > Now we will freeze slabs when moving them out of node partial list to > cpu partial list, this method needs two cmpxchg_double operations: > > 1. freeze slab (acquire_slab()) under the node list_lock > 2. get_freelist() when pick used in ___slab_alloc() > > Actually we don't need to freeze when moving slabs out of node partial > list, we can delay freezing to when use slab freelist in ___slab_alloc(), > so we can save one cmpxchg_double(). > > And there are other good points: > - The moving of slabs between node partial list and cpu partial list > becomes simpler, since we don't need to freeze or unfreeze at all. > > - The node list_lock contention would be less, since we don't need to > freeze any slab under the node list_lock. > > We can achieve this because there is no concurrent path would manipulate > the partial slab list except the __slab_free() path, which is serialized > now. "which is now serialized by slab_test_node_partial() under the list_lock." ? > Since the slab returned by get_partial() interfaces is not frozen anymore > and no freelist in the partial_context, so we need to use the introduced ^ is returned in > freeze_slab() to freeze it and get its freelist. > > Similarly, the slabs on the CPU partial list are not frozen anymore, > we need to freeze_slab() on it before use. We can now delete acquire_slab() as it became unused. > Signed-off-by: Chengming Zhou With the fixup for CONFIG_SLUB_CPU_PARTIAL you mentioned, Reviewed-by: Vlastimil Babka Also agreed with followup patch to rename unfreeze_partials(). Thanks!