Message ID | 20230810163627.6206-13-vbabka@suse.cz (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 1B079C001E0 for <linux-mm@archiver.kernel.org>; Thu, 10 Aug 2023 16:36:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 287CE6B0080; Thu, 10 Aug 2023 12:36:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A39E6B0085; Thu, 10 Aug 2023 12:36:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E44836B0082; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BFBDE6B0081 for <linux-mm@kvack.org>; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4C710B2B54 for <linux-mm@kvack.org>; Thu, 10 Aug 2023 16:36:33 +0000 (UTC) X-FDA: 81108748434.02.A05BF18 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf20.hostedemail.com (Postfix) with ESMTP id 9A9A41C0013 for <linux-mm@kvack.org>; Thu, 10 Aug 2023 16:36:34 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vzqZq8M1; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=NWWqKFNb; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 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=1691685394; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=19h9QNSgdzIWywJanN9veEOMa6s1Xj+q+Cz0v3FP+f4=; b=Hbn4Ltp4ILQ6e/9cjNy5sSsw6TkShBjnTmjxHEfI+Z1BzbDDaQX+2Hz+vA606vMpQX8kww bhDLFDdRwXjoUB8vTFuZNqaBiRRu/f/BOUaQzOxY6iRZbYjM1dGiiAJ/tD4PL5DCOQIFH0 03uJd6Tm/eHaf7mlhBVIvP6V3pzG6Nk= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=vzqZq8M1; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=NWWqKFNb; dmarc=none; spf=pass (imf20.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691685394; a=rsa-sha256; cv=none; b=DcqkSIV76n7D9cSkJqwOeGl8jzF6+0GeEwpjgoeMWfbyiE4/Pb7c8EvoC3lGKPFFeVjS/B UdQgV03M4LDq9CYAZhZXRI9zXAwyzsy0jEUtxX0LroUFjoFlkPMD+YxvHHcXdojwinDuu+ YlJMHQyhHqFN06HUwUav0102/i2mQEk= 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-out1.suse.de (Postfix) with ESMTPS id 302EE2187B; Thu, 10 Aug 2023 16:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1691685393; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=19h9QNSgdzIWywJanN9veEOMa6s1Xj+q+Cz0v3FP+f4=; b=vzqZq8M1QVHjJzcAciJEyysHegc4ljBQedRS1OxPDkK3CHjdyrBTf+D6vESZxsfkhbcdVL MIoyrdIPrePiMNwI+qW9AoKZpWA5gzajN/uBrziCUIySW9YuqYE3Yf3g2M13Ovrbehg/dr vI+tbRZzkrG3tO2oaTs0iBlNzeiRoys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1691685393; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=19h9QNSgdzIWywJanN9veEOMa6s1Xj+q+Cz0v3FP+f4=; b=NWWqKFNbDZBln4sSAtj33wuORgNzUuDPhyE63EaKkKg3gsXILvYYR+v0b3lf9S97ya6XCE f5wjW2+XbXSXUoCg== 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 F1D3C138E0; Thu, 10 Aug 2023 16:36:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IBVjOhAS1WSEPQAAMHmgww (envelope-from <vbabka@suse.cz>); Thu, 10 Aug 2023 16:36:32 +0000 From: Vlastimil Babka <vbabka@suse.cz> To: "Liam R. Howlett" <Liam.Howlett@oracle.com>, Matthew Wilcox <willy@infradead.org>, Suren Baghdasaryan <surenb@google.com>, Christoph Lameter <cl@linux.com>, David Rientjes <rientjes@google.com>, Pekka Enberg <penberg@kernel.org>, Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin <roman.gushchin@linux.dev>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Vlastimil Babka <vbabka@suse.cz> Subject: [RFC v2 4/7] maple_tree: avoid bulk alloc/free to use percpu array more Date: Thu, 10 Aug 2023 18:36:32 +0200 Message-ID: <20230810163627.6206-13-vbabka@suse.cz> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230810163627.6206-9-vbabka@suse.cz> References: <20230810163627.6206-9-vbabka@suse.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9A9A41C0013 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: b1hz4jnszpzuu64kxzbhoauqa1mmjx86 X-HE-Tag: 1691685394-542612 X-HE-Meta: U2FsdGVkX18PTAaBeFP8rv7BiUwbekPLJ8o2MQ9QMaE8xMM36M1vhRQdqKoAj0R/ePcScxuGyeTkXBbbvYIGBscXx5ZLHV+MTy92C9I416GXHoNaNc5mtpVRaZ+3wKQXtt9jSVIgQr0zVsknLvvWvmfsFSb9QVFc/g34A7Y6FfBwh5zIUWk4xyGbBdSjfShRAPy7JWrU58z6B8M1y9eOk8XWVYv/7kcEc4+MTP/hbPCh63yO4HnsTcY8c95qsnhjUN/ExSveoOL99xjXZKFBtfzhiMj1awe+r36/06AXeJq7jXk4Ab9/m62WHbQJHbgfMgdtzvrQCzeBH4cCzvdo5DPayT8fpTZaFY9+47edT7K9+NmqLLTQZjEzFv/GZr2MN18fUcO093SwiQzUXd/3Dj1H2VBu9jDYwJFpXg5sP3eKQwiPKCdcxannu4YOXgqjAD335WUgLpk3RWabimICLoJ5adYguKkn4bBMk3WJb/SySFhHZb3qUWpbnU7fIyn0SML29r9wIgzKyNoJtjtSmJdUKp1/WK/yJHnqHV4K8eTzx3UBceVJ8xcqhh3BGl64clbQMDPTeaSkM3xHLgKpg7GWsKd7o3GKTitNnn8mzZWtlBSV5XPpqDy6pYzxmledhoXuVuPfoF/mXnljDSZ2QtZ8vShWmxVTfdSpgz5BdltzxujKmgWT7m+OlXshbAA7MWsgaPk5y8ynKQ/g9jgpbmIo1mIHcW+VEe0RwgzZ+gO5JM/HcsfI2uAs+TM2LsIwZ6/zNR5vt+lqbMbY84eqKd3CSJ/CzU5PFy7AXGV43Dgkl0HMizo+NZSAghju6KK/B++awUHU9aRkQBX2yDBPnAjNZk5EA82mSHf71hUxDVZdlrB8CvmddZT9ZCNCrKeSm4uOiZQoZ19aCAmuLqXfwhKAkbMUYzoCfxyl2ijrcRVmFJWNSLITVOpbDoMfnYn9hPgOfvyc8q/o6TsjOdB PDuWTj7u 1pgVaFaOaV0QzvPy8r1edqzHFEUxzeW8maAPFWPMh8GrOCd6U+B0W/lEs/2hPBARcyr0XffwDM5LibA4DWHdIVZH99q17h+MdUUN20j3lUv6MhzcoIjqFsJ2so06/NoAnUjw0sBB5+d5eJMxmaTrRkkTzf3XgDPp4mJKzEgABzgOJUEOD+XimdVYrtdKbwpRV4KQZy6IZpRe+NPn49CEvGC0rOg6hMS6VpByNFwkRDxhDAfsO3sZDK4J5ZiO/WBHI7xQvVqoc3N0OgyVOvJb1rJ5WCq/nvbsgmpbshSVbJvAtPkpNE5LVeDAvjA== 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: <linux-mm.kvack.org> |
Series |
SLUB percpu array caches and maple tree nodes
|
expand
|
diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 1196d0a17f03..926bee7a274a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -161,12 +161,20 @@ static inline struct maple_node *mt_alloc_one(gfp_t gfp) static inline int mt_alloc_bulk(gfp_t gfp, size_t size, void **nodes) { - return kmem_cache_alloc_bulk(maple_node_cache, gfp, size, nodes); + int i; + + for (i = 0; i < size; i++) { + nodes[i] = kmem_cache_alloc(maple_node_cache, gfp); + if (!nodes[i]) + break; + } + return i; } static inline void mt_free_bulk(size_t size, void __rcu **nodes) { - kmem_cache_free_bulk(maple_node_cache, size, (void **)nodes); + for (size_t i = 0; i < size; i++) + kmem_cache_free(maple_node_cache, nodes[i]); } static void mt_free_rcu(struct rcu_head *head)