Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1935024pxf; Sat, 3 Apr 2021 05:34:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDcEVK8x/tfurCOdV7kX+gApJhElvmljf2JMql0wfrDi10pJ4nDAyCNYPfpo9XnPLzpNmr X-Received: by 2002:a6b:7302:: with SMTP id e2mr14079247ioh.106.1617453263588; Sat, 03 Apr 2021 05:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617453263; cv=none; d=google.com; s=arc-20160816; b=xse/RZm47wMsKIobFRzvsbPEVa9kv5q40VaBQwdhqQUveJI8/5tVUjd0VkLa3h+EGk V6FMVZubHZFLGbb+I5YRctr3Bw97zsjzjFy4VrwxZhBBvJITu6TSUuAAiGbh0d9RoPCr 3e1pzwVsKLp7CA3eEb7XdWlXvJOG+JrQChQcL4yxFz8/caDrGQm69eeBHOeDKMhima+e 0IfI/++c64+HnZFkKF/evkqOj7l2YYVcmusK4KSLUHbvjCpDE8MKYL6tmBEpv1nTb7yE p+0Bb6r5ABPbTUSZr/Z5nQxl5zHfeGjM/NsEw2+UIjPQEPbHmmc0RENCynFvwOwJB+Vj ds+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :dkim-signature; bh=JhlDW8+W/+5mElmZOwadmaUF2DpTuY2UAaWBafoxcPM=; b=RuucyzIdWTM01vTqzcQ2M/iSTXlGqKPXCZNPlGFita4tZTkUknjyuZZdjSUZLr9sRr aP9Ge/hRxw9KRRKokh1dgKA/FEYWGYXeT3fPOP8WohmmXgjtcYTwRRkHos0pfj2pwbG4 /ipMRRnzFRKqU3Sczg466dUufy4E0L2WFkPf5uM2LNyw+J39L5O7bT/cslw1HYMQ8DUp xwy1DzsEzqNK5nk4CMph4TrvPJ8UfEelL51r6g5gupYPLfLqKecxPLABh6PAzOrOuzl3 Lfjvf0vdPSAhvN6xJ7kBNJAF/K/JMSiBZzvFZBhVMN6JdNldJl+GYD1XUtdAqUwEhUr9 MVXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kpPNY9Pm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c17si10180710jap.11.2021.04.03.05.34.07; Sat, 03 Apr 2021 05:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kpPNY9Pm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231821AbhDCMbv (ORCPT + 99 others); Sat, 3 Apr 2021 08:31:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230409AbhDCMbu (ORCPT ); Sat, 3 Apr 2021 08:31:50 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14B4EC0613E6 for ; Sat, 3 Apr 2021 05:31:48 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id y1so8034161ljm.10 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=BxHn1DPIentcgSLcCukxknS5vk3mTHg/jAlDgzDQMAihbdV/j/O+KnDucyTPvde+8n iAGL0rFcOVs72QGj/wvQuxDynMwqfDmGcv38UykZGupYPsxW4lbQ6T09LYJ55h2Sd9lx qR0mxTE9De5102OymrQqT+mj/st8Ju7T/HsKe0x5hf/n2HN3vDrHyEECMQ7uo44xwigE pf6+yyC5B7QDGn8ff7UrQIx02TJWOZCVZh/6bsLETHEzrlNPMvrs+mMFk+B32l6gZU/F v8cNhspghXtnB+j6A6lYqH4URCdnm1ws0cpHzjldI8msCZ8a4liCTYEMcoOhAXN9ee/8 om6Q== X-Gm-Message-State: AOAM532Ha9mNv79Chem+wQ9uQ1PksQ41KI9IcIQ7Y7TPoDfBMB9YNHxn u3kDi9lQ6RC6Fhx+GCirAoE= 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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