Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp190703rdb; Tue, 31 Oct 2023 05:05:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFc4/I6wJOOAsh/nyc8SftcL4vtmaL9mVdfxfisy/Vu6NjTEBdPG9x+iUZQClKRPnlC3nR X-Received: by 2002:a05:6a00:1a45:b0:6be:4df:2c9c with SMTP id h5-20020a056a001a4500b006be04df2c9cmr15561155pfv.28.1698753921781; Tue, 31 Oct 2023 05:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698753920; cv=none; d=google.com; s=arc-20160816; b=vAZ1Sb2QIrw5khRXtnKjyAV2JPPrGLAKOvHqn3pogD8GeUHS4K628oXNGKAyQKWvYz AWR+M879qD1SlQciA3l7ADklbvGQiQpvRrsQhhO7+zXbpTvk27YzlFvhAf8AfWQAx+lG 8HBjzLMuh93KlFmgst++vkqerNz4O6+irsXAcZ/j1vGknNISaGw8eee1jj21ZeTBD5LV ln+ka9almPiXXQBWq+zP1aJ3QA8O0j4XLXIQyU0wCs+ysExRcaQ9t37wvK/Th28RkiDp vDw+QKM2h+YFkMWdTjJ2IgF4hlorbdqeUIPFOe7/ioEaCk4Im1QUqCXxdb23zCvfAq2h pYxg== 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 :organization:autocrypt:from:references:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature; bh=tizFFarlRzwye9RcySbWtnsOMYZ5mRgBH68nH0EPV+s=; fh=qVt7WPCqqR1EBzzBBKR1tq4j0exUIch2+NEvmAqwPy8=; b=F8gzeKYZtmzrDXtUuzo7+xO1kqhMm8gw34uDsty6VEO7KXwLxqeOOIRzqs+j/d7WVz /aQWE4c/QAU8fxuMg5NqgOdqty9Prm3rFKOTd1ZyUEKmZJDVLSj+DyDckeVkB5nt7VZL 18pLYYdvBKCx+IpPkDAWZyGPN6ZacHVUUL9LC2bo2+VoQNuPX66IgHkQDiXEc0F3wHef PcTziX7NF/hIk8FGk5nQlPT76IsyjWA0u7sFcRkULdgJRpxdUuFI570XsHmiirErb6Lb sF5YrV4ABy3NJJ8gfwNla6cXkk/BjY9M9F3gk9qi/BbfE5hXNW83o/bP3JR+qS8yKfs3 CCig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JZ0qdHfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id j5-20020a056a00234500b006b864485166si931829pfj.146.2023.10.31.05.05.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 05:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JZ0qdHfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2F29180C7105; Tue, 31 Oct 2023 05:05:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344145AbjJaMEt (ORCPT + 99 others); Tue, 31 Oct 2023 08:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbjJaMEs (ORCPT ); Tue, 31 Oct 2023 08:04:48 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F12715583 for ; Tue, 31 Oct 2023 05:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698753838; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=tizFFarlRzwye9RcySbWtnsOMYZ5mRgBH68nH0EPV+s=; b=JZ0qdHfZmLtTvxI1BtweQ11BIUa6b8WQQhxvPWu7CgaU2aD5pdq9Ly1TKfBiNCcseuUwyX WEZnm6gM09jOLM9L5tCHs4olYYDAqJfHbJk4ZXnChClS9nSCKUVHVtskePercsKpIpPQ0E I339Eu8owGiVnO35XsfPpVvwaI/6RFI= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-UvsgnU1RNNeFgy6LO6AAOg-1; Tue, 31 Oct 2023 08:03:56 -0400 X-MC-Unique: UvsgnU1RNNeFgy6LO6AAOg-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-32d9751ca2cso2529113f8f.3 for ; Tue, 31 Oct 2023 05:03:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698753835; x=1699358635; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tizFFarlRzwye9RcySbWtnsOMYZ5mRgBH68nH0EPV+s=; b=jxCZt5grA3+T5+hh4vcQqsZPCCK870jkVkEGH6eyHPMnGUBcRS8NznNpDXhMyyFrB2 L5aQspvNgUGRRE92rsYQ2vrqVefJecSGw5l1Yzsd+gEs+QJmwdwORfRnsCks8q/qvidU TLqThIUbKAHSWVIYb/9Z/skX0wS/gm0W3l14oqtxSepqYhCWDzb/mcWHS97EWJQWEbL5 0MXWKc8diH6sGW0xH2Phqu5vSdS2z4U5OhYdyxxRHlvrcBGArJ58hZHCAoJBVtIDFrS2 JMoqql3kLlwaBIknlYXx8uJufr8Ejx+aS/dvKgzzHcm1DyjxwO1K+1cb3bgDNqmioCUZ R++g== X-Gm-Message-State: AOJu0YxoPw4hsAccVdcjk9BXgutrEJIekuSyxMuvk9IOTXAqm/nOZdCX WCbWQ7cFK8vOmIEs8nKaAwYi7f3J/iXOCwtWwANDPTw8AN3JJPT/1PbmPplxWP6tcBxGPyx/M66 2jKYHiD0QIKUNU2ureJgcr04k7hw8ms9T X-Received: by 2002:a5d:5229:0:b0:32d:9ed0:c31a with SMTP id i9-20020a5d5229000000b0032d9ed0c31amr8203285wra.64.1698753835518; Tue, 31 Oct 2023 05:03:55 -0700 (PDT) X-Received: by 2002:a5d:5229:0:b0:32d:9ed0:c31a with SMTP id i9-20020a5d5229000000b0032d9ed0c31amr8203257wra.64.1698753835063; Tue, 31 Oct 2023 05:03:55 -0700 (PDT) Received: from ?IPV6:2003:cb:c707:8f00:43b0:1107:57d2:28ee? (p200300cbc7078f0043b0110757d228ee.dip0.t-ipconnect.de. [2003:cb:c707:8f00:43b0:1107:57d2:28ee]) by smtp.gmail.com with ESMTPSA id v6-20020a5d4b06000000b0031f82743e25sm1344399wrq.67.2023.10.31.05.03.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Oct 2023 05:03:54 -0700 (PDT) Message-ID: Date: Tue, 31 Oct 2023 13:03:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 0/9] variable-order, large folios for anonymous memory Content-Language: en-US To: Ryan Roberts , 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: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcXFT0V9 PXFNNgV5jXMQRwU0O/ztJIQqsE5LsUomE//bLwzj9IVsaQpKDqW6TAPjcdBDPLHvriq7kGjt WhVhdl0qEYB8lkBEU7V2Yb+SYhmhpDrti9Fq1EsmhiHSkxJcGREoMK/63r9WLZYI3+4W2rAc UucZa4OT27U5ZISjNg3Ev0rxU5UH2/pT4wJCfxwocmqaRr6UYmrtZmND89X0KigoFD/XSeVv jwBRNjPAubK9/k5NoRrYqztM9W6sJqrH8+UWZ1Idd/DdmogJh0gNC0+N42Za9yBRURfIdKSb B3JfpUqcWwE7vUaYrHG1n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VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 31 Oct 2023 05:05:12 -0700 (PDT) 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. -- Cheers, David / dhildenb