From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07298C8300A for ; Tue, 28 Apr 2020 21:00:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF87B21D91 for ; Tue, 28 Apr 2020 21:00:23 +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 AF87B21D91 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) Received: by kanga.kvack.org (Postfix, from userid 40) id A9E5D8E0007; Tue, 28 Apr 2020 17:00:03 -0400 (EDT) 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-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-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 Content-Transfer-Encoding: quoted-printable 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 =20 #define __param(type, name, init, msg) \ static type name =3D init; \ @@ -35,14 +37,18 @@ __param(int, test_loop_count, 1000000, =20 __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. */ ); =20 @@ -328,6 +334,83 @@ pcpu_alloc_test(void) return rv; } =20 +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 =3D 0; i < test_loop_count; i++) { + p =3D vmalloc(1 * PAGE_SIZE); + if (!p) + return -1; + + p->array[0] =3D 'a'; + kvfree_rcu(p); + } + + return 0; +} + +static int +kvfree_rcu_2_arg_vmalloc_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i =3D 0; i < test_loop_count; i++) { + p =3D vmalloc(1 * PAGE_SIZE); + if (!p) + return -1; + + p->array[0] =3D '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 =3D 0; i < test_loop_count; i++) { + p =3D kmalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -1; + + p->array[0] =3D 'a'; + kvfree_rcu(p); + } + + return 0; +} + +static int +kvfree_rcu_2_arg_slab_test(void) +{ + struct test_kvfree_rcu *p; + int i; + + for (i =3D 0; i < test_loop_count; i++) { + p =3D kmalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -1; + + p->array[0] =3D '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[] =3D { { "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. */ }; =20 --=20 2.20.1