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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1708C433EF for ; Wed, 24 Nov 2021 21:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1875F6B0075; Wed, 24 Nov 2021 16:03:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 137B06B0078; Wed, 24 Nov 2021 16:03:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 000006B007B; Wed, 24 Nov 2021 16:03:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id E24036B0075 for ; Wed, 24 Nov 2021 16:03:58 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A3A731810C7FA for ; Wed, 24 Nov 2021 21:03:48 +0000 (UTC) X-FDA: 78845050536.30.B8F1AE6 Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) by imf05.hostedemail.com (Postfix) with ESMTP id 0DB44508BB9E for ; Wed, 24 Nov 2021 21:03:41 +0000 (UTC) Received: by mail-il1-f180.google.com with SMTP id i6so3852783ila.0 for ; Wed, 24 Nov 2021 13:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bRgEs5yEfhkrlGin3uE1wdrU8+VcrbvQSps4QjnAk0c=; b=dwie7mL2uy3cCFRAOewziMhsZTb0pZXsZEEvK34fBghiOgsq0ZmgtunpUR3Droo614 QnZIjMPqWSwf6Tbk6K9QfG8W+PePkZUf9Q8Eb16XBVIRxMmcAVLD9J8ub0vTHzjWFZxJ UKKG5NylWtPOD897dmCZHcvZMIbvQE1dDUyYMSW10Z6n6upcrtSv4KmI8fZ0My/Lh7Vf iT10o+P53kPpMMj2soFmSc1sPIs78UkB7RcGNzwMxmuq2GCGtysNimwYCrx0Vv/4+lHy wwGB8MRZS2wKraVRa5sh4tDv/NMxD9LMxhPi7fuc3OlrZ/GPmHOzb4L+HPtvNCn1y3WL 4Jew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bRgEs5yEfhkrlGin3uE1wdrU8+VcrbvQSps4QjnAk0c=; b=4LB2qHUHB39OGeWbZ8SwEkDj+Z5dHbeAorqxTGdbqGVnr/XasQAVoL6PBecKMycW5h hbE5Ae+p8cg3Z84qOkex3uwYyew8EHlTKle6aZRaJD6OAAzOIWfAsM0lbshbG62ausYt b9yymMN3YV6mEFXHN8mlGPPxBnsfbyLk9tKKQhq8MW8MNJmmoar2S5kUVzGAmbwwMfH4 Wh30DIN0hFVqCSrD7TWnMtOmEKAm3yMbKy/4em5IT9Dc7nsy/BaKQPIFmR/PKks7PRMv 96VUr0tjYBKLjVXmdkwZVjjhwvVf95SS1cq9TBELIQ3XnecGyTNl43cNbFmDK/3ljXfE 4uGQ== X-Gm-Message-State: AOAM533flokPq+0vAcXadcVJVyqjJp3hmJHrLHwcdpvfzJf9CIluV2Rv Rojdt86cQ5uptitTmmDt6J8lkWJymf69YZS79juk9A== X-Google-Smtp-Source: ABdhPJzDrYVvZMlQMF1f8Ii4oZBZ0b9X/HKX/rkq2WetLfBWG93Ny+25ZkGcpfW2TfjCBmr4K7leRbVVDdDK0JYc56o= X-Received: by 2002:a05:6e02:1bc3:: with SMTP id x3mr15195842ilv.39.1637787827560; Wed, 24 Nov 2021 13:03:47 -0800 (PST) MIME-Version: 1.0 References: <20211123204644.3458700-1-yosryahmed@google.com> <6ebcffe2-9513-cbea-a206-15ba927416c7@oracle.com> In-Reply-To: From: Mina Almasry Date: Wed, 24 Nov 2021 13:03:36 -0800 Message-ID: Subject: Re: [PATCH] mm, hugepages: fix size in hugetlb mremap() test To: Mike Kravetz Cc: Yosry Ahmed , Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: koaufes134byjfc4gyjdrtwtij56e7x1 X-Rspamd-Queue-Id: 0DB44508BB9E X-Rspamd-Server: rspam07 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=dwie7mL2; spf=pass (imf05.hostedemail.com: domain of almasrymina@google.com designates 209.85.166.180 as permitted sender) smtp.mailfrom=almasrymina@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1637787821-415347 X-Bogosity: Ham, tests=bogofilter, spamicity=0.005286, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Nov 23, 2021 at 7:42 PM Mike Kravetz wrote: > > On 11/23/21 18:19, Yosry Ahmed wrote: > > On Tue, Nov 23, 2021 at 5:08 PM Mike Kravetz wrote: > >> > >> On 11/23/21 12:46, Yosry Ahmed wrote: > >>> The hugetlb vma mremap() test mentions in the header comment that it > >>> uses 10MB worth of huge pages, when it actually uses 1GB. This causes > >>> the test to fail on devices with smaller memories. > >>> > >>> Signed-off-by: Yosry Ahmed > >>> --- > >>> tools/testing/selftests/vm/hugepage-mremap.c | 2 +- > >>> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> I'll let Mina comment, but I think I know what happened. > > > > Thanks for taking the time to review this and explain what happened. > > > >> > >> > >> The original version of the test did indeed use 10MB. However, the mremap > >> code must 'unshare' and shared pmd mappings before remapping. Since sharing > >> requires mappings of at least 1GB, the size was changed to make sure unsharing > >> worked. > >> > >> In the end, I believe I suggested adding hugepage-mremap to run_vmtests.sh. > >> The script does not try to configure a GB worth of huge pages. And, I think > >> it is somewhat unreasonable to suggest users gave a spare GB to run the test. > > > > Alternatively, we can pass an optional argument to the test that makes it use > > 1GB instead of 10MB. This way, if the test is run with run_vmtests.sh the > > default behavior would be to use 10MB, making sure users do not run out of > > memory. Otherwise, an interested user could run the test without run_vmtest.sh > > and provide the extra argument to make the test use 1GB and make sure that > > unsharing works correctly. Thoughts? > > > > Passing a 'mapping size' argument as you suggest would be best. That way > run_vmtest.sh can pass in a size such as 10MB, but the test could be used > independently with arbitrary size mappings. > > If you have the time to do this, go for it! Yes, Mike's recollection of events makes sense to me. I think that was the mistake that happened (sorry!) Making it configurable makes sense to me. I'm out for the rest of the week but I'll try to review sooner if possible. Thanks for looking into this Yosry!