Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3117305rdh; Mon, 27 Nov 2023 06:54:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhyH7v+6Ss3bJ3f1hTHWqn5nA1XDBtS22ZTphIa1e+lqrwNI5qtRfpywXq0K1LIChIDG8G X-Received: by 2002:a05:6a21:33aa:b0:18b:ef96:be44 with SMTP id yy42-20020a056a2133aa00b0018bef96be44mr12349479pzb.26.1701096875968; Mon, 27 Nov 2023 06:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701096875; cv=none; d=google.com; s=arc-20160816; b=R4zkvpNmrCvv5YO2j2HyDmkqABw3OPHu07dH+MhiCjUHMBkB022s+pI3A2Hul1gJzG ZaltmWHu+7G9NPn8rTtQL/Jd6/5RLEc4XqV4x5wCllb7JVQVzTIpkHhHN2uOWRCgYCRb 7U0PDe14jhiLqV4tSBE00LtDFHcfxiSTAwonlkVbl8zUJDuMcgigPP4Ggzukcn//tJE0 vp6OVLQwOsJ+erK+177rZBk35HimMaehDqfG3KffN+gJtOdSEI6Qu89Km4YjOxD2JHx0 fLK49qEJw7b73S3NpyMl5za4qx2dP+J4QjeTnSzp8vIku7gzuZ+gaTZKr+hqwzGRRSwR wuyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=u+CY/hlz7qpPrdOoVyvz7MOZFwI7x0cWYI0GTlNtAjk=; fh=54AJWpiqQ3cdbHPA70Y9Pk8Om9mG1/HMX+mu17RN1dY=; b=CXCjh3d+bRKmbr1ToGsI8W83quW6OdXDv92Sn081qwlq5u209bwsNHMu8WXm0sM+nR loXVq9jk/L17c70oFwxN7AZpehmNEN9EMzMx13GbtFWe5GH3v4n2rrKiMWzVbNCD2tQu pwR8C/dfCNK6gLV5zTV24scFUEfDuUY+ZUMV5wPkNTmc2AotbswHl4ZeTc5HmPWTkPfb kTEDi7MbWq8SMGBf+LRf4/s9C0wqtvRjaTf5re+GmWllQmYQ9UCTcov13oGBNBr727LF Mhjs0i1AezWObcEAfr7QpXwCRPVj95ASsImawMOu26oUKfQq9aUTSKeVj8tlaRxM+T+t FcQA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id y32-20020a631820000000b005bd85b5a76csi9687834pgl.274.2023.11.27.06.54.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:54:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 47A7C806CC37; Mon, 27 Nov 2023 06:54:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233568AbjK0OyY (ORCPT + 99 others); Mon, 27 Nov 2023 09:54:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233485AbjK0OyX (ORCPT ); Mon, 27 Nov 2023 09:54:23 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0AD8C99 for ; Mon, 27 Nov 2023 06:54:30 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5F1AC2F4; Mon, 27 Nov 2023 06:55:17 -0800 (PST) Received: from [10.57.73.191] (unknown [10.57.73.191]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B814D3F6C4; Mon, 27 Nov 2023 06:54:26 -0800 (PST) Message-ID: <28bc0263-c297-4392-b70a-df8214ca1a67@arm.com> Date: Mon, 27 Nov 2023 14:54:25 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RESEND PATCH v7 10/10] selftests/mm/cow: Add tests for anonymous small-sized THP Content-Language: en-GB To: David Hildenbrand , Andrew Morton , Matthew Wilcox , Yin Fengwei , Yu Zhao , Catalin Marinas , Anshuman Khandual , Yang Shi , "Huang, Ying" , Zi Yan , Luis Chamberlain , Itaru Kitayama , "Kirill A. Shutemov" , John Hubbard , David Rientjes , Vlastimil Babka , Hugh Dickins , Kefeng Wang Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20231122162950.3854897-1-ryan.roberts@arm.com> <20231122162950.3854897-11-ryan.roberts@arm.com> <8dd0f52c-d261-4541-930f-bd4e5921be5b@arm.com> <13a2ce75-b1c0-4930-8911-36ded0b428a7@redhat.com> From: Ryan Roberts In-Reply-To: <13a2ce75-b1c0-4930-8911-36ded0b428a7@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:54:34 -0800 (PST) On 27/11/2023 14:50, David Hildenbrand wrote: > On 27.11.23 15:02, Ryan Roberts wrote: >> On 22/11/2023 16:29, Ryan Roberts wrote: >>> Add tests similar to the existing PMD-sized THP tests, but which operate >>> on memory backed by (PTE-mapped) small-sized THP. This reuses all the >>> existing infrastructure. If the test suite detects that small-sized THP >>> is not supported by the kernel, the new tests are skipped. >>> >>> Signed-off-by: Ryan Roberts >>> --- >>>   tools/testing/selftests/mm/cow.c | 71 +++++++++++++++++++++++++++++++- >>>   1 file changed, 70 insertions(+), 1 deletion(-) >>> >>> diff --git a/tools/testing/selftests/mm/cow.c b/tools/testing/selftests/mm/cow.c >>> index d03c453cfd5c..3efc395c7077 100644 >>> --- a/tools/testing/selftests/mm/cow.c >>> +++ b/tools/testing/selftests/mm/cow.c >>> @@ -29,15 +29,49 @@ >>>   #include "../../../../mm/gup_test.h" >>>   #include "../kselftest.h" >>>   #include "vm_util.h" >>> +#include "thp_settings.h" >>> >>>   static size_t pagesize; >>>   static int pagemap_fd; >>>   static size_t pmdsize; >>> +static int nr_thpsmallsizes; >>> +static size_t thpsmallsizes[20]; >> >> Off the back of some comments David made againt the previous patch [1], I'm >> proposing to rework this a bit so that ALL thp sizes are stored in this array, >> not just the non-PMD-sized sizes. This makes the changes overall a bit smaller >> and easier to understand, I think... >> >>>   static int nr_hugetlbsizes; >>>   static size_t hugetlbsizes[10]; >>>   static int gup_fd; >>>   static bool has_huge_zeropage; >>> >>> +static int sz2ord(size_t size) >>> +{ >>> +    return __builtin_ctzll(size / pagesize); >>> +} >>> + >>> +static int detect_smallthp_sizes(size_t sizes[], int max) >> >> This changes to detect_thp_sizes() and deposits all sizes in sizes[] > > Just what I wanted to propose :) Makes it simpler by removing the "small" > terminology and just detecting thp sizes. Great! All done and queued up for the next version. Just waiting for some feedback on the 2 crucial patches in this series (3 & 4) :)