Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp231835rdb; Tue, 31 Oct 2023 06:12:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD35afikxgxhPe3cgLDJdbkqSQdoTeMT4KX4GWijh384npNNlLSVx3YlDc7XOvMd/RZ2uQ X-Received: by 2002:a05:6a00:2d08:b0:6c0:642c:274b with SMTP id fa8-20020a056a002d0800b006c0642c274bmr11145513pfb.9.1698757950018; Tue, 31 Oct 2023 06:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698757950; cv=none; d=google.com; s=arc-20160816; b=bjYqoRVrcBaX6Jjp86dJYB7NpowTThgSvyx4O7xXVFkCVrNL5AXbCaI8nuClCuIPlb 6yjmObNn74Z1joDQBIyK7m2X6rLYh5Q1D2XhJ6q59FHb0aQKebeRT3/skaGztOOF4bJj 6v7nSZnY2VF+aSbGS+e4XPlITMOaryzlUo/6VwzsmEwt2LtReWzNanq0KrfgLwjK1I7k 1QOY13/T0rfT5aUXmjeDhn1sOdvC2jMUJhFiG3d1DfO13ypjgDjZw17YlmevPMUx/9iI ZHB6ov5MRMwITk+aLmIfMczf5tBtGJSwMsgtbWkratPjStQw5FmtMscIrLuq2Cx3vaXW 0qVw== 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=I90jh+Bm1tmFYdgCa5G5DsN9bZyvmQMY/Ttsn+CoSU8=; fh=LnKJiXXEsEfAmQ0GA7JIV4WyubX5Q0FERJtFNFMD3yY=; b=ZxcRQWeyxCMoWVapLnoGfMrnVFJit9EzABK2YzHuo4nQywbLlVOfj8nR+SJy+MpnjR RMw5f9+L4BWHk2PhiZkKgb6U5gNP0/FvGu+IRfuNS5ardAhQyc4dW9unhs7jSYhFAjP2 3MNMKQXcb30sPGL9nQSH1aEUr7JNiXfo4H6BLrA11e6xsPu32w/FEujPRGORlbh3RLXa YUW+JA5eICf3YUImv1+biFIqEQwfegquTOdGhdYoE9+mNjrpwwezDgr+92JAiz9Qyk5+ 6xoialCbCcSFTfQTGeZV2DBxJ5j+7U1S1YoqZy7/EM1e53RkZeNGy0ySTgZqCO7FQHHh Ah4w== 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 h25-20020a633859000000b005ab6142f1besi1048204pgn.169.2023.10.31.06.12.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 06:12:29 -0700 (PDT) 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 5E6C8801E875; Tue, 31 Oct 2023 06:12:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344452AbjJaNM0 (ORCPT + 99 others); Tue, 31 Oct 2023 09:12:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344447AbjJaNMZ (ORCPT ); Tue, 31 Oct 2023 09:12:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 365F9E4 for ; Tue, 31 Oct 2023 06:12:22 -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 94DFCC15; Tue, 31 Oct 2023 06:13:03 -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 82A713F738; Tue, 31 Oct 2023 06:12:19 -0700 (PDT) Message-ID: Date: Tue, 31 Oct 2023 13:12:18 +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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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]); Tue, 31 Oct 2023 06:12:28 -0700 (PDT) On 31/10/2023 11:58, David Hildenbrand wrote: > On 31.10.23 12: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, > > Hi! > >> >> 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). > > Anon was (way) first, and pagecache later decided to reuse that one as an > indication whether larger folios are desired. > > For the pagecache, it's just a way to enable/disable it globally. As there is no > memory waste, nobody currently really cares about the exact sized the pagecache > is allocating (maybe that will change at some point, maybe not, who knows). Yup. Its not _just_ about allocation though; its also about collapse (MADV_COLLAPSE, khugepaged) which is supported for pagecache pages. I can imagine value in collapsing to various sizes that are beneficial for HW... anyway that's for another day. > >> >> 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? > > The latter would be my take. Just like we did with the global toggle. ACK > >> >> 2) The global control will continue to drive the file-backed memory decision >> (for now), even when hugepages-2048kB/enabled != "global"; agreed? > > That would be my take; it will allocate other sizes already, so just glue it to > the global toggle and document for the other toggles that they only control > anonymous THP for now. ACK >