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: 134125 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp577067vqi; Thu, 10 Aug 2023 10:35:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1qWdJmxHug6VfpQ8p48+LjTJKm6Xm9MtxDYmapAT8bGYpdybax91QBwAoG7rAmQyVRi6w X-Received: by 2002:a05:6a00:1508:b0:667:85e6:4e9 with SMTP id q8-20020a056a00150800b0066785e604e9mr3492282pfu.24.1691688936633; Thu, 10 Aug 2023 10:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691688936; cv=none; d=google.com; s=arc-20160816; b=gHq/6wsGLMXesd9f+nVR5H4PNieVcv+CFdgGbZq3ut2Nx8lmSdiH3yizCeR8qjqVgj OFNBDKWxnKEcwUNxa5VUeVGXLQrvRsdNLLujQWD3Ve8mUXkJ/t+q5Y6WE5MxbDDmCsha omndf9CzxzoQnYw8MvWXrW6H3felBhN2gBbkbTz9npfKU2KICJgUkAhm+TXzSmwJZa+O 4UoP2jEHcGd3t4zzWszx9xwKY5JBbfAAk0IgPXkoBiHCGc3aSTonQhfs6Ox1VH3zEZ41 Z8A9jPKRI0RMPf5MGAKhz8PmFpf/0i/VfOCX7X2Kgs2Wthq1/BkFvw1HzgY7CxzrAivT 4VDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=cIe5o/xpdmWF4fStDltZQwKQCcPAraOzhHNBE1tj7sI=; fh=2pBnSfjX50e7Wv5klf1T27fGwt6nBz7bVyyBTq15zE4=; b=l5SDJsy71UMmRhW51DemMLTNJf4m3AUuNl9naqGM1kPCWk4iem+ZK4seeB8R7pKSVs qNc3dR/ofriG8YTGpIxEAwByaQethiF+/aFx86GFJ7djfc3k9SAd1IIUwx1NBcgfw0Ga KW/oL+nKEgp/pLvvjm5crrVtHtJdk5+WAwWFz8C2SZ0qzrJRBL6jtmAUhM5m2e9lgK/S oNID1HaTxrPLSpNzo30hqkSrdgTlHHImHMtfQhCvuuZDELmO4hyfEu6weT+2ErXSzSKl CHz+T7vFry2BBViTHdl0LSIWH6osKBfFmjohZ/wxCdySP8gr+0+dE8047IdsPKFZN7Qj 1N0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=jFDhujQK; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h21-20020a056a00219500b00665e0165510si1920115pfi.252.2023.08.10.10.35.05; Thu, 10 Aug 2023 10:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=jFDhujQK; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235797AbjHJQgw (ORCPT + 99 others); Thu, 10 Aug 2023 12:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235109AbjHJQgf (ORCPT ); Thu, 10 Aug 2023 12:36:35 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 305FD9C for ; Thu, 10 Aug 2023 09:36:35 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773864418351085752 X-GMAIL-MSGID: 1773864418351085752 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