Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1307333lqp; Fri, 22 Mar 2024 10:55:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdOpfgSmn8JvLHZgmNE3KA4j/fE35h1PdXTU88F0YriglFA8rcF0Br+m6pUgbR1xxGQzbx22VOtWjkUP1bU3vEa6LLO2pMIbtdKZkPNg== X-Google-Smtp-Source: AGHT+IHc5xH9PQIBiUXCTE1IGIqcqzGEdk/ZOqPUezhdzGoVrVjWwj+Hedaedc1qa7XiVFbj4Y+I X-Received: by 2002:a05:620a:400b:b0:788:7a62:83de with SMTP id h11-20020a05620a400b00b007887a6283demr206304qko.8.1711130108151; Fri, 22 Mar 2024 10:55:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711130108; cv=pass; d=google.com; s=arc-20160816; b=TvxH5vDzVDaahzIOL/ykFeIPI9qJe1FSsdtzdm/WgzNgjrX9Idp5Vx1pLSdfdkdQGp Ga5d/k7OGgWD4qKU51F/9jlBYvWWLIAXspSYg+e4oD8sDWPxN3Z7Fc3q/k54MtaVFbeu u56Pr3yRFKECt/LCiN4IJmh9lcr/yDPjf5zZczx5T12ASO237s8QjXvCkT9vdUUC1Onx w9sqB9/PZYKYK1CnFOt95wLF8AXOATbIhrZeg3p6Ah8DYPYODur7K0V5omuao3ijeC1w M8h7YBCYIA4Ce12DXBJin6cAG/n8+k1cbdFVVtWVosdajyqDJ9TZiNwpDqJwEiQ5w/A1 hX5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=QWtlMLncVgXdNdQuKDFm1Nwigzs6rR7s8i+ituIt+FE=; fh=iMXOU61iiSE5Ssw1XwB0wXOHwahCaZiyNlT+wQ48Y70=; b=hRBWQRS0Pu/oPo0eiBE5jQsIGdH1zubZiFF/pDEiMK/rdxm1iiogUk4MtlhN8KF6OE 549vNtCIXNkwzvVzcMoIuR2I1R2HXRd4DboYmHc69IAjcMH8Tyx31rugvYG/0iWOP3fC +MbOSgDhj6+0E7+FPzBzGP3nzxGj8f8GW4yeH1jUxluI7439CI116r7Qcp7EFD5RSJ7l FIqpans88VBd/VsNfs5/n3J4ULlIzthiBt6fh6lHQAn4ticnzrxY4lB2pAzMOD1sQ5eV sFGYzObS6MtTSnGU7lD4+iJdflMsiH4zDZYql3rcwMCCUSzbgiXy8r+wi3qYLDYTXSMD lG5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g4+DXiRZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-111890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id xy13-20020a05620a5dcd00b0078a34f33f29si64793qkn.407.2024.03.22.10.55.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 10:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g4+DXiRZ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-111890-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CD5F81C2139E for ; Fri, 22 Mar 2024 17:55:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A70AD60B82; Fri, 22 Mar 2024 17:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="g4+DXiRZ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 294AC60898 for ; Fri, 22 Mar 2024 17:55:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711130103; cv=none; b=mEu5jabzbJEfFECs/4z84VW0bjmAvQbcBEeQS3W26INwwf8b5d3vRXOrhS/T1hsuqFU6C5rEIkPjQwEqIf+RgtChgndzef+Xp7ehlxztm3bqSpCjInrB2axP1OH2jNMq6VFLogSdLBqEg57WykiZ7JqC3esfPtu9DYxAMLoIy30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711130103; c=relaxed/simple; bh=jacSXxd4+PQh90z3ZdhMrF6sKCnxSt8KJchtgsTt90E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=os6ZlfrOvl5+p58pBn69fOULWYqCBYz3AeP+R//y5R74j8/YNAx+2gKJqj6ea0KV03Wxk/g4EYmtJuA6JTeZULayCHNTa833kmpLYXOUkulmEqSjujW5Gjp2LmtnD+VlS9vCQq7OvDUL6pP/UDL32HKpZZmZMC5SxzV1KkSgmiU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=g4+DXiRZ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711130098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=QWtlMLncVgXdNdQuKDFm1Nwigzs6rR7s8i+ituIt+FE=; b=g4+DXiRZWdJGkxga47Qxd3xRZ1MAiSIWMMvibWU0yz+rY5pVRbSTBp31qGgNTyA7aQz7u2 BDNR0rHofkK2j7BzyjRxTaDJPhxeuP/OpbPQcrCBzdU22FUH9dLjCmnfJvjHQbf39+H3BN Yi1oxSQReE9ZmNFcVtvLIrAW6oMwOCU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-KzgXkWMMN5ypLSM-NPkxcw-1; Fri, 22 Mar 2024 13:54:56 -0400 X-MC-Unique: KzgXkWMMN5ypLSM-NPkxcw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4140cc9cdcfso12560405e9.2 for ; Fri, 22 Mar 2024 10:54:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711130094; x=1711734894; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QWtlMLncVgXdNdQuKDFm1Nwigzs6rR7s8i+ituIt+FE=; b=mKpi3Gtm/jBZGG3FvvY9cGepMaG4X2TSMhNypsbOS6Fy1pLjFmltSgLkt3bdOEqeJ6 ahlGpLfo/NrpZZ6LTObp3zzWE/HiF6VZYESROr+w7SnJs1C1LfM/TMl4GlrqzIqAsBWO 0yvWYf8Dq/omgrOMVka7Y9WAFUxi8eehL5drqcGtUY45aG0FQXhvk+DB6W5ndssef+1N bc3mJ7/56b2YlX3MFD5FvWjr5QdSfQkDOBYO0XCXX6YIenoF6pK1c9dJoq1JDrdIz9sX 09bvdeiFgmcGaSBGFY0yfsiLAQCUMPwvCtAURZ2sGk5A3YtaYTEZNBOaOqcmq+zu6M9+ RdnQ== X-Forwarded-Encrypted: i=1; AJvYcCW28IXjj1SLfw1sD+y86C1iooVbOGQx7iq9yBHATKHe4xrojf5NNh9agc2oGesl5zF1EqvvXn5N+I8pffJDWs5gYplChlulHA2WSh0b X-Gm-Message-State: AOJu0YybcSlAqfg5sFfuDKyJxASVf23smU21HVyhA3XOmeVW8LABn9RA BhGakGBGAz0R4jo5XYus5QwW4ulO7ij9R+WT1pQxhTHtKuJkizWkJUjAzlK6iUegiyyYKRM/RIK xBo5XxQbB4mLfjBoKBysU0a/H2xRigo8pAQMIYSejuFRVAmN6zfWT8tZV/vDWUg== X-Received: by 2002:a05:600c:1c85:b0:414:1400:9773 with SMTP id k5-20020a05600c1c8500b0041414009773mr99201wms.0.1711130093941; Fri, 22 Mar 2024 10:54:53 -0700 (PDT) X-Received: by 2002:a05:600c:1c85:b0:414:1400:9773 with SMTP id k5-20020a05600c1c8500b0041414009773mr99179wms.0.1711130093526; Fri, 22 Mar 2024 10:54:53 -0700 (PDT) Received: from ?IPV6:2003:cb:c71b:7e00:9339:4017:7111:82d0? (p200300cbc71b7e0093394017711182d0.dip0.t-ipconnect.de. [2003:cb:c71b:7e00:9339:4017:7111:82d0]) by smtp.gmail.com with ESMTPSA id l15-20020adfa38f000000b0033e03a6b1ecsm2571021wrb.18.2024.03.22.10.54.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 22 Mar 2024 10:54:53 -0700 (PDT) Message-ID: <14c72ad9-d05c-4b77-b1e8-a8b4a454f977@redhat.com> Date: Fri, 22 Mar 2024 18:54:52 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] selftests/mm: run_vmtests.sh: Fix hugetlb mem size calculation Content-Language: en-US To: peterx@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Muhammad Usama Anjum , Nico Pache , Muchun Song References: <20240321215047.678172-1-peterx@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9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IMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <20240321215047.678172-1-peterx@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 21.03.24 22:50, peterx@redhat.com wrote: > From: Peter Xu > > The script calculates a mininum required size of hugetlb memories, but > it'll stop working with <1MB huge page sizes, reporting all zeros even if > huge pages are available. > > In reality, the calculation doesn't really need to be as comlicated either. > Make it simpler and work for KB-level hugepages too. > > Cc: Muhammad Usama Anjum > Cc: David Hildenbrand > Cc: Nico Pache > Cc: Muchun Song > Signed-off-by: Peter Xu > --- > tools/testing/selftests/mm/run_vmtests.sh | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh > index c2c542fe7b17..b1b78e45d613 100755 > --- a/tools/testing/selftests/mm/run_vmtests.sh > +++ b/tools/testing/selftests/mm/run_vmtests.sh > @@ -152,9 +152,13 @@ done < /proc/meminfo > # both of these requirements into account and attempt to increase > # number of huge pages available. > nr_cpus=$(nproc) > -hpgsize_MB=$((hpgsize_KB / 1024)) > -half_ufd_size_MB=$((((nr_cpus * hpgsize_MB + 127) / 128) * 128)) > -needmem_KB=$((half_ufd_size_MB * 2 * 1024)) > +uffd_min_KB=$((hpgsize_KB * nr_cpus * 2)) > +hugetlb_min_KB=$((256 * 1024)) > +if [[ $uffd_min_KB -gt $hugetlb_min_KB ]]; then > + needmem_KB=$uffd_min_KB > +else > + needmem_KB=$hugetlb_min_KB > +fi > > # set proper nr_hugepages > if [ -n "$freepgs" ] && [ -n "$hpgsize_KB" ]; then Reviewed-by: David Hildenbrand -- Cheers, David / dhildenb