Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp232566rdb; Tue, 31 Oct 2023 06:13:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnPw3p0MSrF3a699m3y7XJCySAmCd15vmnZ0ToJxlufOzQGJarQFcVzF0htp7h8qJ9DSyh X-Received: by 2002:a92:c548:0:b0:358:ffc:e7b4 with SMTP id a8-20020a92c548000000b003580ffce7b4mr17787299ilj.16.1698758006644; Tue, 31 Oct 2023 06:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698758006; cv=none; d=google.com; s=arc-20160816; b=SKbIglGDdLTxIFB3KOSURpagwYIj8sif7n4UPsvuVmDzobvL/+GJPQVsOPGyQcXtg2 3Bm4GyrTYm23jl/rXHf6kSd9L4d6/2unV2QgmH97VbKLXbGy4+Dvs9Q+6e+tUnv6bFTS yjdIdiN9f0SjvHivie0UzcEBFSzdeHmr+YVf8+VhJCzh+42FepNsz8FhmgNuj1+mjceU grXLBlg+r1XhdXa7Wndkw9l6AXnO/wLRfmvrQ9DK6tk+QAWEA+FfpT/Y5+w3vUXN9Lpl V2gFEyOmLGDMS0mQ+bvSkei2rZTa7h18UEc09DeuaXxW89kO2uSTbz7VkmD84gbDNwMc pt/g== 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=bwuhtf0/9/UwmLBRlSlxigiQor5F03iGZjpqGqYep2w=; fh=LnKJiXXEsEfAmQ0GA7JIV4WyubX5Q0FERJtFNFMD3yY=; b=LwB8580oClOzs1qguByfpLHV98P1F3ASftm7miWYWmvfAMn0mjRkEPFBHyaSndFi4W 7IfHJxCDRhC9EcIEejobjFiyQzbgNXf7XB+ec0iAvFGJD8DMnP42kau0Mvbs44G4CPO2 qBsPC8rCdmd/law68OSTF1Vnqxk5coX6YqZ/yNWh+BetyYfPLxLSWLjciYcNVMIl5NFo YhDskSi0BFUYm64sAEbydGYtM3g8hin7VmX5JlTfITeI3dMGY01d1Hk7aRbdowuCD9cn 9Dp6/f1J9VGTrHFy6N4+1Mgg4fUlocFvfYbCJ6u0yNTD6dcjNRmdZJf3sAaWaS2z/e+6 /oIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s7-20020a635e07000000b0055c8d58cee9si991374pgb.714.2023.10.31.06.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 06:13:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id ACA6A80218CD; Tue, 31 Oct 2023 06:13:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344460AbjJaNNR (ORCPT + 99 others); Tue, 31 Oct 2023 09:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344458AbjJaNNQ (ORCPT ); Tue, 31 Oct 2023 09:13:16 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B369BF7 for ; Tue, 31 Oct 2023 06:13:13 -0700 (PDT) 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 2C522C15; Tue, 31 Oct 2023 06:13:55 -0700 (PDT) Received: from [10.1.34.180] (XHFQ2J9959.cambridge.arm.com [10.1.34.180]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1946A3F738; Tue, 31 Oct 2023 06:13:10 -0700 (PDT) Message-ID: <5001e231-795f-4d8c-bd9d-16096e428aef@arm.com> Date: Tue, 31 Oct 2023 13:13:10 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 0/9] variable-order, large folios for anonymous memory 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 Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230929114421.3761121-1-ryan.roberts@arm.com> <6d89fdc9-ef55-d44e-bf12-fafff318aef8@redhat.com> <7a3a2d49-528d-4297-ae19-56aa9e6c59c6@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 06:13:23 -0700 (PDT) On 31/10/2023 12:03, David Hildenbrand wrote: > On 31.10.23 12:55, Ryan Roberts wrote: >> On 31/10/2023 11:50, Ryan Roberts wrote: >>> On 06/10/2023 21:06, David Hildenbrand wrote: >>> [...] >>>> >>>> Change 2: sysfs interface. >>>> >>>> If we call it THP, it shall go under "/sys/kernel/mm/transparent_hugepage/", I >>>> agree. >>>> >>>> What we expose there and how, is TBD. Again, not a friend of "orders" and >>>> bitmaps at all. We can do better if we want to go down that path. >>>> >>>> Maybe we should take a look at hugetlb, and how they added support for multiple >>>> sizes. What *might* make sense could be (depending on which values we actually >>>> support!) >>>> >>>> >>>> /sys/kernel/mm/transparent_hugepage/hugepages-64kB/ >>>> /sys/kernel/mm/transparent_hugepage/hugepages-128kB/ >>>> /sys/kernel/mm/transparent_hugepage/hugepages-256kB/ >>>> /sys/kernel/mm/transparent_hugepage/hugepages-512kB/ >>>> /sys/kernel/mm/transparent_hugepage/hugepages-1024kB/ >>>> /sys/kernel/mm/transparent_hugepage/hugepages-2048kB/ >>>> >>>> Each one would contain an "enabled" and "defrag" file. We want something >>>> minimal >>>> first? Start with the "enabled" option. >>>> >>>> >>>> enabled: always [global] madvise never >>>> >>>> Initially, we would set it for PMD-sized THP to "global" and for everything >>>> else >>>> to "never". >>> >>> Hi David, >>> >>> I've just started coding this, and it occurs to me that I might need a small >>> clarification here; the existing global "enabled" control is used to drive >>> decisions for both anonymous memory and (non-shmem) file-backed memory. But the >>> proposed new per-size "enabled" is implicitly only controlling anon memory (for >>> now). >>> >>> 1) Is this potentially confusing for the user? Should we rename the per-size >>> controls to "anon_enabled"? Or is it preferable to jsut keep it vague for now so >>> we can reuse the same control for file-backed memory in future? >>> >>> 2) The global control will continue to drive the file-backed memory decision >>> (for now), even when hugepages-2048kB/enabled != "global"; agreed? >>> >>> Thanks, >>> Ryan >>> >> >> Also, an implementation question: >> >> hugepage_vma_check() doesn't currently care whether enabled="never" for DAX VMAs >> (although it does honour MADV_NOHUGEPAGE and the prctl); It will return true >> regardless. Is that by design? It couldn't fathom any reasoning from the >> commit log: > > The whole DAX "hugepage" and THP mixup is just plain confusing. We're simply > using PUD/PMD mappings of DAX memory, and PMD/PTE- remap when required (VMA > split I assume, COW). > > It doesn't result in any memory waste, so who really cares how it's mapped? > Apparently we want individual processes to just disable PMD/PUD mappings of DAX > using the prctl and madvise. Maybe there are good reasons. > > Looks like a design decision, probably some legacy leftovers. OK, I'll ensure I keep this behaviour. Thanks! >