From patchwork Thu Aug 10 16:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13349722 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 4FF09C04FE0 for ; Thu, 10 Aug 2023 16:36:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0A406B0081; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBA416B0080; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDB1F6B0083; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 8658A6B0080 for ; Thu, 10 Aug 2023 12:36:37 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 609D51A0306 for ; Thu, 10 Aug 2023 16:36:37 +0000 (UTC) X-FDA: 81108748434.09.9598A03 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 32DAC40025 for ; Thu, 10 Aug 2023 16:36:34 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jFDhujQK; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=PdU68wcF; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691685395; 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=cIe5o/xpdmWF4fStDltZQwKQCcPAraOzhHNBE1tj7sI=; b=u6PivWeWEniR2332np6EiqT9yrGvjiliB/axiV0tXXmfEZ30yz5z6d/Y2dleGt2t7ExPI3 I9RB1kxIUfwYxf8xWdh+nm3tU/JxDFz6HzkA9Yj4PZ+uGtwYxSd1WN1tb+qeu6tOBwZtfc fP5JUC80gHb3BraTSBrJ9Kol2UOWNT4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691685395; a=rsa-sha256; cv=none; b=pG8NlmYkxZJBN6Z1GnOtmEv8r4nqV8iMrlLLh6B3T/kEP5y1u64Itfe74yNBrFqjW2hIBI ty2Uc1orZvGJanmtlvVM+OzCQo7TdSLUwCkX7MNzCJqJYl0M4v7rrdKWKOmYC8GdoSCzc4 uYqcfpiSRXxF7qGzA/6RNSrGMb+Uwrc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=jFDhujQK; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=PdU68wcF; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none 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 B89CB2187D; 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=cIe5o/xpdmWF4fStDltZQwKQCcPAraOzhHNBE1tj7sI=; b=jFDhujQK9jnwYC5KTNeGJCIlO2KBUw/XTV80/Sckd7ry6MpJADq8984Hcb/JcLyttdyOCc By0JjZpyPSMRUFs60gV0TZ5tiJmU656Gez67m2SNag97I5yOFGfQMRohSq16iolp/mFQ1E r7ASU8hfgP0p2GuDAsPTINkLoM6TUww= 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=cIe5o/xpdmWF4fStDltZQwKQCcPAraOzhHNBE1tj7sI=; b=PdU68wcF1isVbJVPgMJg1tS6L1fRdxB0QJp3XEvCF5yMZ3vLhenlySUtF9nHAX+uGFzMuT KyYySGhI6o/rPMDQ== 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 8FB1C139D1; Thu, 10 Aug 2023 16:36:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SCB6IhES1WSEPQAAMHmgww (envelope-from ); Thu, 10 Aug 2023 16:36:33 +0000 From: Vlastimil Babka To: "Liam R. Howlett" , Matthew Wilcox , Suren Baghdasaryan , Christoph Lameter , David Rientjes , Pekka Enberg , Joonsoo Kim Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Vlastimil Babka Subject: [RFC v2 7/7] tools: Add SLUB percpu array functions for testing Date: Thu, 10 Aug 2023 18:36:35 +0200 Message-ID: <20230810163627.6206-16-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 X-Rspamd-Queue-Id: 32DAC40025 X-Rspam-User: X-Stat-Signature: a6he5fyzwe9w7ooazitbi4dkugc1ogos X-Rspamd-Server: rspam03 X-HE-Tag: 1691685394-110231 X-HE-Meta: U2FsdGVkX19a5qcNYP3B47ceu3r8QePOhJ5c0A9VHu32IHJzUJlmr2nRpcLoLcXhR0e0m4M0uXI5hp6mImOTJPmlxRcuUM2Z9JB09Axspcq8Oh/ng27Rj3UnK7NVPRVc0s9URS/ei68DEao8jqGP4J1Kvo33aZSmv2MhuJyWUgDKWqECNnGxC9g1W72EBcnuEtQmyRRLXN5WL3amk3OJG2yQ6o+AxLoZ6iyw03nWrFMs7uPEqSFBw15hE3BeV3mqazTbPd8aSEZESL+tlMgb4/EAUEihiQWULp43TLzelzraujB4J3TECEWg99oCbKN62CvmXtWkSwWgfTkgF+vLrAOjn1G9irSgYcbwRrlCrHMdLn7U2visNXzrDYuiDMMYAixmUcOwanj4GSRaUOa6NsuVEYg5XXUH5bH8oW8OA7KGkBE93CVYq2+QPI39Vnxeikqaoh5cSdjRQaO+9UOcYfqTvI8KwNcm3dX4wpenSrv3GXorSsbwEtkQ6u1FKCj3Hs3+MF5m0qebB30tQvkEwN1XXO8ylPp9BE+/VYfUuuh/aHlAdYhvta6U+w7dVZBGg2jvyhVZ+eKlazqp2dxyyLjqDqT4o9U8jZQLXoAT+HpbMGTCLn0GnTYRLSz0oxnfgBfOj/RP79MPIEDWsUxhCFAsP37/MN2wkc08QHUUBmj2F06A1N8HdQPJfbARdhUWXRXJ7zkIfuhsf0+Y1gnl/qgvaCT1/ZxxiqhmviW83wd7qDpnut6HTcyLLj01Lrq1G4u2CDbW0od3k/lLe8X4lmnnDbytuKjbStEBniiY3fhO8v7f3hIPv5CCwhk+HESPVO/510DuW9tere8JJNruHdRft3wN1eqXz0Qb0SWAojh0J0gmlv8rx93jsDk5gqTNoMASuSQdtAUUUSt8r4Ow1SoNaFsHGIi/zlA7RxAe8oedUTCTu4vK0YCkw2CXR8QcIFZRfjPM4WgLoMKZBfX WDOkwhgx MwmGH5qCFPI3ZIkPputEl8fZm8rbbNDyMQDxy1T+2mOTjuZ7tak1PpBuJWjeJwo7b2oeC0X4dBoT9s2r/VFHyyOdfJmAcUFY/vGWh/ZMJ03luCq2Y8Eks2I+U1Q8+tgML1vPoJBZB+gAWKH79hmkx034lowJL9YYSGUXBAjA+2BaGSNAJ6VNhm3xNm0ohnKi4FgYvJ21z2mNthUVxDuVpVAo2ag59t5ZFdEffmqblXEXhb0wJgQiEOOCqRwTDPrdeULOPSQ4G5ja7OehwLEKdlXRDmQ== 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: From: "Liam R. Howlett" Support new percpu array functions to the test code so they can be used in the maple tree testing. Signed-off-by: Liam R. Howlett Signed-off-by: Vlastimil Babka --- tools/include/linux/slab.h | 4 ++++ tools/testing/radix-tree/linux.c | 14 ++++++++++++++ tools/testing/radix-tree/linux/kernel.h | 1 + 3 files changed, 19 insertions(+) diff --git a/tools/include/linux/slab.h b/tools/include/linux/slab.h index 311759ea25e9..1043f9c5ef4e 100644 --- a/tools/include/linux/slab.h +++ b/tools/include/linux/slab.h @@ -7,6 +7,7 @@ #define SLAB_PANIC 2 #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ +#define SLAB_NO_MERGE 0x01000000UL /* Prevent merging with compatible kmem caches */ #define kzalloc_node(size, flags, node) kmalloc(size, flags) @@ -45,4 +46,7 @@ void kmem_cache_free_bulk(struct kmem_cache *cachep, size_t size, void **list); int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size, void **list); +int kmem_cache_setup_percpu_array(struct kmem_cache *s, unsigned int count); +int kmem_cache_prefill_percpu_array(struct kmem_cache *s, unsigned int count, + gfp_t gfp); #endif /* _TOOLS_SLAB_H */ diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index d587a558997f..cbe7937fdd5e 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -187,6 +187,20 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size, return size; } +int kmem_cache_setup_percpu_array(struct kmem_cache *s, unsigned int count) +{ + return 0; +} + +int kmem_cache_prefill_percpu_array(struct kmem_cache *s, unsigned int count, + gfp_t gfp) +{ + if (count > s->non_kernel) + return s->non_kernel; + + return count; +} + struct kmem_cache * kmem_cache_create(const char *name, unsigned int size, unsigned int align, unsigned int flags, void (*ctor)(void *)) diff --git a/tools/testing/radix-tree/linux/kernel.h b/tools/testing/radix-tree/linux/kernel.h index c5c9d05f29da..fc75018974de 100644 --- a/tools/testing/radix-tree/linux/kernel.h +++ b/tools/testing/radix-tree/linux/kernel.h @@ -15,6 +15,7 @@ #define printk printf #define pr_err printk +#define pr_warn printk #define pr_info printk #define pr_debug printk #define pr_cont printk