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.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 5EE0FC433ED for ; Sat, 3 Apr 2021 12:31:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9772611ED for ; Sat, 3 Apr 2021 12:31:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9772611ED 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 0DA156B0071; Sat, 3 Apr 2021 08:31:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B1CA6B0075; Sat, 3 Apr 2021 08:31:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E463B6B0078; Sat, 3 Apr 2021 08:31:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id C5BA86B0071 for ; Sat, 3 Apr 2021 08:31:48 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 794241B408 for ; Sat, 3 Apr 2021 12:31:48 +0000 (UTC) X-FDA: 77990992296.13.A3226DD Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by imf16.hostedemail.com (Postfix) with ESMTP id 8870F80192C0 for ; Sat, 3 Apr 2021 12:31:47 +0000 (UTC) Received: by mail-lj1-f181.google.com with SMTP id s17so8064168ljc.5 for ; Sat, 03 Apr 2021 05:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JhlDW8+W/+5mElmZOwadmaUF2DpTuY2UAaWBafoxcPM=; b=kpPNY9PmZlM5Moo4l/KEvk4b/ohTkfoBS3pv8d2gIGBV6MsFjbmdcNzeJSipM/2+Li 58sLsawGWoWI/4IqIilwmRpoUs7FYUn16q3VH4tfTDDNjtO25BgHIZcVjpSmV8qTisJA ULm6PElnAjXz25P2Di5UC9AYnVidSCNJubidL+CjDs0oJl/69mHtIN5vZwyNIMbEM5sD Ps8hjDb0sGs0FxARwBCmAuJIFwQ6c2sjmxSNIchgZ8Qd9/9bIAbIblD8g9RCBcvVWU/T mifLJbQlajcqDxJHMsyx/DyFOEPztVjqeetvjMcL1bAUQbD+3W4EkQq1QdqpblKPM2Ro JIOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JhlDW8+W/+5mElmZOwadmaUF2DpTuY2UAaWBafoxcPM=; b=Ntp/v87PkAimKjy7hqx/x/FN0b72SmKq3Cbpg7u/0gKpHSPvli614W9GQ/aQgcoeD8 PXzB03ewMkA/p+N8lxXR0hKyydGoKBAch8AQvaFYtyF9MIiYthQHXpvj/+XqXrpIqz8H AiTUlDzVMzjc/PYg8hxhmvH9k35Bc1wYZ491Py9LB/WWFPI2mkInDCE+WDJI7T0jxINS ybXY3GyTXPU7i41+PXGXqXJVsOoXvazqUgD7RKPGY8QlbklODk2H47vrla+Tkch5e/z3 uPeqcA4HIrU/Gfc7BNUhubgv+vBi+ppcrT+30Ng+krHzKUzxAtgKzeyxasSNritN66s9 DjoA== X-Gm-Message-State: AOAM532HkX6g3WEOsVXHyGg6SBPcjk3vpSrZAoMtNAOlYbBxXLawLl7w 9gw0vjv1xd3UnWf3bLdl7fE= X-Google-Smtp-Source: ABdhPJwpclg9KoHYmWHg17yt0xp1Jtcx66PUSggulrktalxt4zvZXC3zSwynTJO/AVTyd9orh5rlUw== X-Received: by 2002:a05:651c:106e:: with SMTP id y14mr10743945ljm.418.1617453106424; Sat, 03 Apr 2021 05:31:46 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id f22sm1137093lfc.68.2021.04.03.05.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Apr 2021 05:31:45 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Sat, 3 Apr 2021 14:31:43 +0200 To: Andrew Morton Cc: "Uladzislau Rezki (Sony)" , linux-mm@kvack.org, LKML , Hillf Danton , Michal Hocko , Matthew Wilcox , Oleksiy Avramchenko , Steven Rostedt Subject: Re: [PATCH-next 2/5] lib/test_vmalloc.c: add a new 'nr_threads' parameter Message-ID: <20210403123143.GA38147@pc638.lan> References: <20210402202237.20334-1-urezki@gmail.com> <20210402202237.20334-2-urezki@gmail.com> <20210402145934.719192be298eadbeecb321d2@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210402145934.719192be298eadbeecb321d2@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8870F80192C0 X-Stat-Signature: rpiuowrqbthkisjgm4t59e46r51613jf Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=mail-lj1-f181.google.com; client-ip=209.85.208.181 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617453107-568246 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: > On Fri, 2 Apr 2021 22:22:34 +0200 "Uladzislau Rezki (Sony)" wrote: > > > By using this parameter we can specify how many workers are > > created to perform vmalloc tests. By default it is one CPU. > > The maximum value is set to 1024. > > > > As a result of this change a 'single_cpu_test' one becomes > > obsolete, therefore it is no longer needed. > > > > Why limit to 1024? Maybe testers want more - what's the downside to > permitting that? > I was thinking mainly about if a tester issues enormous number of kthreads, so a system is not able to handle it. Therefore i clamped that value to 1024. >From the other hand we can give more wide permissions, in that case a user should think more carefully about what is passed. For example we can limit max value by USHRT_MAX what is 65536. > > We may need to replaced that kcalloc() with kmvalloc() though... > Yep. If we limit to USHRT_MAX, the maximum amount of memory for internal data would be ~12MB. Something like below: diff --git a/lib/test_vmalloc.c b/lib/test_vmalloc.c index d337985e4c5e..a5103e3461bf 100644 --- a/lib/test_vmalloc.c +++ b/lib/test_vmalloc.c @@ -24,7 +24,7 @@ MODULE_PARM_DESC(name, msg) \ __param(int, nr_threads, 0, - "Number of workers to perform tests(min: 1 max: 1024)"); + "Number of workers to perform tests(min: 1 max: 65536)"); __param(bool, sequential_test_order, false, "Use sequential stress tests order"); @@ -469,13 +469,13 @@ init_test_configurtion(void) { /* * A maximum number of workers is defined as hard-coded - * value and set to 1024. We add such gap just in case + * value and set to 65536. We add such gap just in case * and for potential heavy stressing. */ - nr_threads = clamp(nr_threads, 1, 1024); + nr_threads = clamp(nr_threads, 1, 65536); /* Allocate the space for test instances. */ - tdriver = kcalloc(nr_threads, sizeof(*tdriver), GFP_KERNEL); + tdriver = kvcalloc(nr_threads, sizeof(*tdriver), GFP_KERNEL); if (tdriver == NULL) return -1; @@ -555,7 +555,7 @@ static void do_concurrent_test(void) i, t->stop - t->start); } - kfree(tdriver); + kvfree(tdriver); } static int vmalloc_test_init(void) Does it sound reasonable for you? -- Vlad Rezki