From patchwork Tue Apr 28 20:59:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 11515601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A8D192C for ; Tue, 28 Apr 2020 21:00:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B62672072A for ; Tue, 28 Apr 2020 21:00:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nMGZ+fe6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B62672072A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B13FC8E001D; Tue, 28 Apr 2020 17:00:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A9E5D8E0007; Tue, 28 Apr 2020 17:00:03 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 89F738E001D; Tue, 28 Apr 2020 17:00:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 6FAA38E0007 for ; Tue, 28 Apr 2020 17:00:03 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2964C181AC9CB for ; Tue, 28 Apr 2020 21:00:03 +0000 (UTC) X-FDA: 76758481086.04.party54_57b75f02c2c02 X-Spam-Summary: 2,0,0,bbfdedbd8116665c,d41d8cd98f00b204,urezki@gmail.com,,RULES_HIT:41:355:379:541:800:960:965:966:973:982:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1544:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2987:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:4118:4321:4385:4390:4395:5007:6261:6653:7514:9163:9413:10004:11026:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12683:12895:13161:13229:13870:13894:14181:14394:14687:14721:21080:21444:21451:21627:21666:21990:30029:30054:30056:30070,0,RBL:209.85.208.195:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: party54_57b75f02c2c02 X-Filterd-Recvd-Size: 7282 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Tue, 28 Apr 2020 21:00:02 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id g4so259056ljl.2 for ; Tue, 28 Apr 2020 14:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pFz29Ncgyaz8z/1Qp2+b1WJTbiL+UppT5lx2exYc8qs=; b=nMGZ+fe6xiYOw++aC//Z8OF1EzE9mTIAXdtY2wYZBb4quZdq+MAuktQTFSZimsBMfv yr21ycB+3x8EE/b74Vi1nlowx9liJrqN0hO2NzaxZ09mbYg4k5xi/sFv5/E/hf/J9SV/ e68LuotEDHAqBbYzGSwp7SvvkcwdYmbSeLMoXn5Qq0UJyehqB8pu8BGqUIsvl4CBGCPP usSTKwwlhyWEonVJtNoaJp5318qEf+frWelZvLRGS7Lrr9DEw+4lr1MSFUEtPNnVYlp2 ZiNz53ok5DGi27Ny8bImfXSRM6zS9vQSS6Ac2KO1RkonVz58KfwAw+Yk1vsf5eAAN/0f KU+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pFz29Ncgyaz8z/1Qp2+b1WJTbiL+UppT5lx2exYc8qs=; b=dp99ovC3vzVuYTR0yWatwc3cMOax3acvgh27GttMWq/3l7XeYNOFrSKq4hio7KQQed fzacABLZMdgJPVSnwhRF0L9n/dXl8i3V3KpqTzx2natuOMIETj9tUFLQZtsMlI+FmdfJ x6O7Cyk2WYI1n4IwB/YXlwVyoPvEjwcCkNdmy16jW3zZJMMOVjcaULsjkFQxstPjIbqL WWzm8ysOSCMhDN9Y+7i9/tLcLNyOpBKTBk4mJZFfWDSrS2ZuIhtINCRrjVzao7/Cvl6d Wa0aJnnjSxv77AY8J/XhmYuSihZCn2M/fA97o5D9sUowoEEEUiQOJ9obCwHmAdG8OJL9 uXXw== X-Gm-Message-State: AGi0PuYj/fVQ9v75OORk5g2IlB7IJshOCQMfrLb/eWppBARwYkmbke/7 h0X3RhFMknOw2VKgJrrWsM7ONkOaXrBGtQ== X-Google-Smtp-Source: APiQypLE5mxTFoU3KAMfpCj2cbiae08hkJfL0cpRwE+8diBE7xGLdv5s1UOvFjgkkhBVYoqWhWEgHQ== X-Received: by 2002:a2e:8083:: with SMTP id i3mr18677202ljg.175.1588107601389; Tue, 28 Apr 2020 14:00:01 -0700 (PDT) Received: from pc638.lan (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id z21sm295483ljh.42.2020.04.28.14.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 14:00:00 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: LKML , linux-mm@kvack.org Cc: Andrew Morton , "Paul E . McKenney" , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , RCU , Uladzislau Rezki , Oleksiy Avramchenko Subject: [PATCH 24/24] lib/test_vmalloc.c: Add test cases for kvfree_rcu() Date: Tue, 28 Apr 2020 22:59:03 +0200 Message-Id: <20200428205903.61704-25-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428205903.61704-1-urezki@gmail.com> References: <20200428205903.61704-1-urezki@gmail.com> MIME-Version: 1.0 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: Introduce four new test cases. They are considered to cover and testing of kvfree_rcu() interface. Two of them belong to 1 argument functionality and another two for 2 arguments functionality. The aim is to stress it, to check how it behaves under different load and memory conditions, analysis of the performance throughput and its impact. Signed-off-by: Uladzislau Rezki (Sony) --- lib/test_vmalloc.c | 103 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 95 insertions(+), 8 deletions(-) diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index 8bbefcaddfe8..ec73561cda2e 100644 --- a/lib/test_vmalloc.c +++ b/lib/test_vmalloc.c @@ -15,6 +15,8 @@ #include #include #include +#include +#include #define __param(type, name, init, msg) \ static type name = init; \ @@ -35,14 +37,18 @@ __param(int, test_loop_count, 1000000, __param(int, run_test_mask, INT_MAX, "Set tests specified in the mask.\n\n" - "\t\tid: 1, name: fix_size_alloc_test\n" - "\t\tid: 2, name: full_fit_alloc_test\n" - "\t\tid: 4, name: long_busy_list_alloc_test\n" - "\t\tid: 8, name: random_size_alloc_test\n" - "\t\tid: 16, name: fix_align_alloc_test\n" - "\t\tid: 32, name: random_size_align_alloc_test\n" - "\t\tid: 64, name: align_shift_alloc_test\n" - "\t\tid: 128, name: pcpu_alloc_test\n" + "\t\tid: 1, name: fix_size_alloc_test\n" + "\t\tid: 2, name: full_fit_alloc_test\n" + "\t\tid: 4, name: long_busy_list_alloc_test\n" + "\t\tid: 8, name: random_size_alloc_test\n" + "\t\tid: 16, name: fix_align_alloc_test\n" + "\t\tid: 32, name: random_size_align_alloc_test\n" + "\t\tid: 64, name: align_shift_alloc_test\n" + "\t\tid: 128, name: pcpu_alloc_test\n" + "\t\tid: 256, name: kvfree_rcu_1_arg_vmalloc_test\n" + "\t\tid: 512, name: kvfree_rcu_2_arg_vmalloc_test\n" + "\t\tid: 1024, name: kvfree_rcu_1_arg_slab_test\n" + "\t\tid: 2048, name: kvfree_rcu_2_arg_slab_test\n" /* Add a new test case description here. */ ); @@ -328,6 +334,83 @@ pcpu_alloc_test(void) return rv; } +struct test_kvfree_rcu { + struct rcu_head rcu; + unsigned char array[20]; +}; + +static int +kvfree_rcu_1_arg_vmalloc_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i = 0; i < test_loop_count; i++) { + p = vmalloc(1 * PAGE_SIZE); + if (!p) + return -1; + + p->array[0] = 'a'; + kvfree_rcu(p); + } + + return 0; +} + +static int +kvfree_rcu_2_arg_vmalloc_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i = 0; i < test_loop_count; i++) { + p = vmalloc(1 * PAGE_SIZE); + if (!p) + return -1; + + p->array[0] = 'a'; + kvfree_rcu(p, rcu); + } + + return 0; +} + +static int +kvfree_rcu_1_arg_slab_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i = 0; i < test_loop_count; i++) { + p = kmalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -1; + + p->array[0] = 'a'; + kvfree_rcu(p); + } + + return 0; +} + +static int +kvfree_rcu_2_arg_slab_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i = 0; i < test_loop_count; i++) { + p = kmalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -1; + + p->array[0] = 'a'; + kvfree_rcu(p, rcu); + } + + return 0; +} + struct test_case_desc { const char *test_name; int (*test_func)(void); @@ -342,6 +425,10 @@ static struct test_case_desc test_case_array[] = { { "random_size_align_alloc_test", random_size_align_alloc_test }, { "align_shift_alloc_test", align_shift_alloc_test }, { "pcpu_alloc_test", pcpu_alloc_test }, + { "kvfree_rcu_1_arg_vmalloc_test", kvfree_rcu_1_arg_vmalloc_test }, + { "kvfree_rcu_2_arg_vmalloc_test", kvfree_rcu_2_arg_vmalloc_test }, + { "kvfree_rcu_1_arg_slab_test", kvfree_rcu_1_arg_slab_test }, + { "kvfree_rcu_2_arg_slab_test", kvfree_rcu_2_arg_slab_test }, /* Add a new test case here. */ };