Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4726659pxf; Tue, 23 Mar 2021 19:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgEaWoxQruatY4QeXXRR7/4gJ9jrxQ/+1cHHwfA6LSxp54umKadzR+tOuY0GRxvpaoY/zv X-Received: by 2002:a17:906:fcb2:: with SMTP id qw18mr1157936ejb.434.1616552749943; Tue, 23 Mar 2021 19:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616552749; cv=none; d=google.com; s=arc-20160816; b=lh6hKKNMaOct40A9PqeFeIwRxyLRkm/feY4MLcIBnZ1WycT+K7W2biQlaw3+6a5SA7 qYhkn8/kyomuH9ipPO2tJAJV6Gn20rmrcazOb35sexxP2SRBZipxGOA1qSqPipugSqbs b/Mch0Sx5OUIN5Hywv+qm2hTOXLSiSi/J24t0qTEBNL1InggLl3svsDXP4ESs0zSllV/ c8tb40wLolxUL06xCNfRyWGlXbJSJ5gUUoBJ61XiodsJCsjonJsoHLTVgDUSztTY2Bld wJ6/2yUNIl/VRXsfBx1nTd4cYhg4cvJeS1LX6hjyG5kJgyN1cnZS2BzbU/aE4V2pwRSj XEJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UX1wWuXrQQyIUDqW54U/sMyEQTlMEB2HoQOh/hCP6fM=; b=b2QQOne0OVA0GDCLn7zAZzGIdbdw4o1yDmVdMXmTh/VkXFKTwQEtbCGc3OsI5xE7FW /b4mM91PYwD6eFe++ac5W4d6TMIOb4DPRz73ve1rCfBkNXQ85s+PGR01il7N8Oof5Vmd PC1t4lPV1XZZ9Nr0G7k9V/RL5KiwQBGFk6pRJfrcGAR8ZAAZyCHRuE9O/8NZ6i1fDe5W ZgnAIm6FdUgV5WYiYdJ+St3b7Bw/bsu2Fp7notxKhpeW5ma5FllgUKfAkIE7rmbtXCQs 5JjwEpKHuhmAeAeag4hrbs6pb9cASwVxt86I8CkRAnKwCpG3FNzS+XCkLIV2nh5oJFPR AIKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="VNqwPM/S"; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si625989ejf.645.2021.03.23.19.25.27; Tue, 23 Mar 2021 19:25:49 -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=@redhat.com header.s=mimecast20190719 header.b="VNqwPM/S"; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231869AbhCWOIu (ORCPT + 99 others); Tue, 23 Mar 2021 10:08:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27026 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232084AbhCWOIS (ORCPT ); Tue, 23 Mar 2021 10:08:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616508497; 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: in-reply-to:in-reply-to:references:references; bh=UX1wWuXrQQyIUDqW54U/sMyEQTlMEB2HoQOh/hCP6fM=; b=VNqwPM/SEoQxb26sWsBgAQfNBLKqXYq44qF/4spw5TKmDp/jjQwewXY8PmHNtLJTro+PAU ARdo8mPVuQQeBIfKY4dcEtdvzCZIi0jagwvwMAXoxK274xBn1CPr4rDC7R9Ao7pEQbYX78 h0+XPotGj0SrFoUDQsbjoo6nRomTHjQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-W6YLLq2qMNGvDS32cfJI2A-1; Tue, 23 Mar 2021 10:08:13 -0400 X-MC-Unique: W6YLLq2qMNGvDS32cfJI2A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B7B98189CB; Tue, 23 Mar 2021 14:08:12 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.40.194.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6ACAB694CC; Tue, 23 Mar 2021 14:07:45 +0000 (UTC) Date: Tue, 23 Mar 2021 15:07:42 +0100 From: Andrew Jones To: Yanan Wang Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Gardon , Sean Christopherson , Vitaly Kuznetsov , Peter Xu , Ingo Molnar , Adrian Hunter , Jiri Olsa , Arnaldo Carvalho de Melo , Arnd Bergmann , Michael Kerrisk , Thomas Gleixner , wanghaibin.wang@huawei.com, yuzenghui@huawei.com Subject: Re: [RFC PATCH v5 06/10] KVM: selftests: Add a helper to get system configured THP page size Message-ID: <20210323140742.5nubgjbwvqe7c52f@kamzik.brq.redhat.com> References: <20210323135231.24948-1-wangyanan55@huawei.com> <20210323135231.24948-7-wangyanan55@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323135231.24948-7-wangyanan55@huawei.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 09:52:27PM +0800, Yanan Wang wrote: > If we want to have some tests about transparent hugepages, the system > configured THP hugepage size should better be known by the tests, which > can be used for kinds of alignment or guest memory accessing of vcpus... > So it makes sense to add a helper to get the transparent hugepage size. > > With VM_MEM_SRC_ANONYMOUS_THP specified in vm_userspace_mem_region_add(), > we now stat /sys/kernel/mm/transparent_hugepage to check whether THP is > configured in the host kernel before madvise(). Based on this, we can also > read file /sys/kernel/mm/transparent_hugepage/hpage_pmd_size to get THP > hugepage size. > > Signed-off-by: Yanan Wang > Reviewed-by: Ben Gardon > --- > .../testing/selftests/kvm/include/test_util.h | 2 ++ > tools/testing/selftests/kvm/lib/test_util.c | 29 +++++++++++++++++++ > 2 files changed, 31 insertions(+) Reviewed-by: Andrew Jones