From patchwork Wed Nov 29 09:53:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13472568 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 7789CC07CB1 for ; Wed, 29 Nov 2023 09:53:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 39AE56B03BB; Wed, 29 Nov 2023 04:53:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 095D16B03BF; Wed, 29 Nov 2023 04:53:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDD676B03BA; Wed, 29 Nov 2023 04:53:42 -0500 (EST) 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 443766B03C0 for ; Wed, 29 Nov 2023 04:53:42 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0643C1404E1 for ; Wed, 29 Nov 2023 09:53:42 +0000 (UTC) X-FDA: 81510529884.21.BB14862 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf23.hostedemail.com (Postfix) with ESMTP id D5FE9140009 for ; Wed, 29 Nov 2023 09:53:39 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 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=1701251620; 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; bh=PX3MvAB9bT05yeaZSR4WJfiyLfcVNVB/Ayxh6IAIMM0=; b=TgEWBB2zJ0zh8+93bgQPrXjQIegtBQtRp+ppZJHwpi9/eggJ1DJ/hG48dSgoStLollT5G8 lJeYHBnQ/Jdfnxq6KxOS9O+UalBKq+0UR5ddK5k7Hf+daEH2Zk1DeJMy674Hwcj52YKCb0 La+dCGMEXpPzXp6ZweRjK7mFy7i0EiE= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf23.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701251620; a=rsa-sha256; cv=none; b=G7ZCs9PrcoIRcbxozrIAEpktaqhWNetr3DMiNiupBKYQ4Dpq+YwfkvjCUVxoQDF/Sb96Od 3F1/nbyol1qm9jf/xkhYro4apPRnIfaGhVE1Ta6G2l3VvVndM3etg1nG6Pk2NTQFxA6i0z rcC7GYJxK5eRj2m/Z6OeweQ0eStwbgo= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 E628721995; Wed, 29 Nov 2023 09:53:37 +0000 (UTC) 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 59C0B13A9D; Wed, 29 Nov 2023 09:53:37 +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 yN2eFSEKZ2UrfQAAD6G6ig (envelope-from ); Wed, 29 Nov 2023 09:53:37 +0000 From: Vlastimil Babka Date: Wed, 29 Nov 2023 10:53:31 +0100 Subject: [PATCH RFC v3 6/9] tools: Add SLUB percpu array functions for testing MIME-Version: 1.0 Message-Id: <20231129-slub-percpu-caches-v3-6-6bcf536772bc@suse.cz> References: <20231129-slub-percpu-caches-v3-0-6bcf536772bc@suse.cz> In-Reply-To: <20231129-slub-percpu-caches-v3-0-6bcf536772bc@suse.cz> To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Matthew Wilcox , "Liam R. Howlett" Cc: Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Alexander Potapenko , Marco Elver , Dmitry Vyukov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, kasan-dev@googlegroups.com, Vlastimil Babka X-Mailer: b4 0.12.4 X-Rspam-User: X-Stat-Signature: tnj1psxo7dz6e9uk7fntr1c6urgexfyh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D5FE9140009 X-HE-Tag: 1701251619-151661 X-HE-Meta: U2FsdGVkX19zQf0r6/iyo7wgFubhFJcxpzE+cnSnYSpeY0+hFZKJyOiUadaSXimbJd+MU2CgTS2vrbboIV9HE/VO35TZDmxpNNzGdQ4Z4aL0unfOcNgZJtroA3GJ1S3chRv4HZUugP2WQcTs8KpXMa1WvTwI/+hPvVmwByqorwR8FHx48vE7q00Nv6+5tNyFji0v0P368He1nwYfFSva3QyVQFlo+PxEPNQzR8/OXuBbEfxgBYi+QpcHU2KHRfdSiU+Oaz+S9j1vtauRAt5G7fBHvleDxU1wLDvfaJU8hJRW/HQxyTkcxGYyujN49kWgfGfzkPgTF+XfMk4RAuSy2T6isWs35rLfvBK8huzwnnygGTGFd8m7gl7lMUdct75t/UO3Fd788QBCnaDJA/k+Q9rdyY4ClnWBtsffRZBKCejHkZ766sAZIhqPDMaFS8ye5YAglCiowFlMT43FYhbLRouJbEKpWbPnu7x6XTdF4UTwthfgbLWP5+G1vYOiPKGlZ+ccHq1mBGy5NvBm34fo/RmG5v2kJk8BbMLwXkOSL6XS8JH8g0e25bWjZ2aw1vpcoe0kGmPz4VB8aoyfRf2iAgkVJcE/2scOxF1FzjWGgC/DGQN6gBUYCRfMuxYEGAuqAjbCVwLYNMwHIuneskYiRTW8YqcMFav7mL9QLcjt4RbB5JpV6weyfTbTKpKQT9Qwk590B7yfKr65le1O6E09aKMSg+VlG0m7VtGBdWceA2QtdJPN3Qdc6FeWL2Y2HLoCi3vnPLmiO1mf2/UOcTAIC0FQWANUKkgklQkYm8wK6ybSRLsXF1pk6kKZqbjdJtejXStbP0+Vi/fU0em+VniHf1bOPcZf3hz5gQkF+NlByCYxcAs3tP8lLDPUmamCPMnTCCghqV079kEYhYjKDicnLakiIo64ll2klHPzZBzhjIY06d0Rjlk0/b/cNSi82oh+tvo6eXPjJIlrPJ4H5FF EcwJajRW BNuydWI5yA8ChtlIk83SSSGGTlOQwA790321G6xqyfoeXMe0l2SRXWLRnoxCSS/sf8pquc97swHNlwV6npCsTyY1HTplpUeiU347cELxj0VNIFQunzueKSXLF6vhKKrwaz/xUv5cq8n5xyHnxO9LrUOMl2GmV/bHEO5yVtqJ/DTkTwW2g61eALW8AHTjoOZxeieURioBWdPdze83jFt4ht5qKXg== 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: 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 61fe2601cb3a..3c9372afe9bc 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