Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp517492rdh; Thu, 26 Oct 2023 08:20:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHxTCmNxaC2x/Xy/vmFhdHbppqIsRfIinsgwGbbaupOJjdWAq24nRNTYTvcvgRS7H5MI2j X-Received: by 2002:a05:6102:45:b0:452:7f81:1502 with SMTP id k5-20020a056102004500b004527f811502mr18891735vsp.26.1698333617278; Thu, 26 Oct 2023 08:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698333617; cv=none; d=google.com; s=arc-20160816; b=YOfM8E47yvNFFOboqJIJtuI5u8KqI0U8SQNMKjGUS43I/oO3bDkphQ48ryU1EUbfYl viKbZtr+x4TB2wF9q2G0ZsKgkLRek7d9M4nlnhYDwbqF0a594ko4CMWObcKMCPyOV3yR LILUpYqTTjhq+aubEyS7P9ND23giyim9R8zfPQ9k/lh87l08glPo+fJsBvz7AClDr/D0 AHZts/q4magtfs2NKQwsxtLo/8ZbCIjlTHW1tJT+vrxi6b7W6N7D+NX0SHMBCp9MwVWd rH6VOFbUmvPudDrjiBa964A+ZW1SkZzxmKJa8b3OBPLVEvcnd8q+iPX+DOnK1axWD6P8 fLYw== 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=UQTE/uZhwruB06To4tgPtgPqKLZ44cEicp3yc0ToX6I=; fh=ypUkUbDYszZqPZTUotp8mtQ1EI9IBQYmvVljhCzAt5o=; b=cMGAHhvXkXvF/i9VMvN8HEMJfsQl5oh1quFFI2aiTLvCg9hl/1ZmCu7E20/HDqbu/V ziXWUzzBE2oL7Ist4Qk1WH9yIpTdpPaSGjp0R9y1VAIgvQIMcdECIeE4li+cxSbvoLeY 6BhMMLKwWwxHuwFF+9afK9pSdv7hw7K/Z+ajR0FRT6HZYT2DiHJI8iVmlbk7dSyFUt8X IEGpn96euOJAhSUxjODIQWP7fYS6UrSzJYSkKI//H3D4gbSgi1ekS6PfbGVnqyLObeGW pdMJqZznqxq5vZQ9z8Dfp/tv/UQa16E79zUfTVFYqc/w/l3+aPdl1aKo1Z0n5fKKcdoP 0cwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RUoKcMSJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e24-20020a056102225800b00452ef1f9285si1506996vsb.496.2023.10.26.08.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 08:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RUoKcMSJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 9DDD8801C0B9; Thu, 26 Oct 2023 08:20:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345380AbjJZPUB (ORCPT + 99 others); Thu, 26 Oct 2023 11:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbjJZPUA (ORCPT ); Thu, 26 Oct 2023 11:20:00 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852FCD7 for ; Thu, 26 Oct 2023 08:19:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698333553; 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=UQTE/uZhwruB06To4tgPtgPqKLZ44cEicp3yc0ToX6I=; b=RUoKcMSJNekXI9qYeEKienSuWBvPNeXGNUuZCiJd3nZ/zESZUcTMUSpjBldZhzH+hTSOYG rrd1dlnLggqaGGmLmJHk35+FqJk1EbzxFcDtDm+Z/h5dzd3E+OhXfSHv+bC1EQRZ0iKwV3 Xp2aiypFo+gQLGqXojIF8CKW+tUVMEQ= Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-9UskHWXONW6W0ZvAtz4s4g-1; Thu, 26 Oct 2023 11:19:11 -0400 X-MC-Unique: 9UskHWXONW6W0ZvAtz4s4g-1 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2c50d4a1a33so10038901fa.0 for ; Thu, 26 Oct 2023 08:19:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698333550; x=1698938350; 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=UQTE/uZhwruB06To4tgPtgPqKLZ44cEicp3yc0ToX6I=; b=mzINetK06niRBiJ5E3vaifDOvctNK/T6CJA8bYb96zFbedRu0oFwtM0D8L8ScwjS29 rAzaff0CGoA6NEy8QrMQnhE4yH01QdKX1QJq4ALIU8Rsk18v72acwf/UpbxTnF1ptSTV 5zdmeSZCh8dpilqS/TK/QRVgHHJvoS3VlilI3BzpqKD40YL9cyWOZD0LyLxclGCg6hrx GhjMBZ/++/JOYASqjBQ4VBNRea1AHdbk2VfeI+0e8fhi1ggwYhozrXYy2vMXMIDyBNNg M+c6bRAxrvXo2UguDur3R0qaowP4suMpl5oyrsNkL/zhvONuMIbsvwgJw0iKHFq3F/3j B9WQ== X-Gm-Message-State: AOJu0YwGXWcgdiEPRDcenswUgnfYiKZ35PpN1UibsC9/t4w3cH4MBrVk YzWEukzBU7avqxn3LTsBF+4ZN/DawQdnY9N4IJM+1cfpYnrhgIbnxAu2RFldvnA72+yULKXj2Ei 7aBbNl6Y71dDlLo3GtuN9tE2v X-Received: by 2002:a05:651c:1986:b0:2c0:afd:e7ed with SMTP id bx6-20020a05651c198600b002c00afde7edmr16240974ljb.10.1698333550229; Thu, 26 Oct 2023 08:19:10 -0700 (PDT) X-Received: by 2002:a05:651c:1986:b0:2c0:afd:e7ed with SMTP id bx6-20020a05651c198600b002c00afde7edmr16240950ljb.10.1698333549643; Thu, 26 Oct 2023 08:19:09 -0700 (PDT) Received: from ?IPV6:2003:cb:c70d:a900:cf04:d43b:114c:655a? (p200300cbc70da900cf04d43b114c655a.dip0.t-ipconnect.de. [2003:cb:c70d:a900:cf04:d43b:114c:655a]) by smtp.gmail.com with ESMTPSA id r4-20020adff704000000b0032d88e370basm14491435wrp.34.2023.10.26.08.19.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Oct 2023 08:19:09 -0700 (PDT) Message-ID: Date: Thu, 26 Oct 2023 17:19:08 +0200 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 , Yu Zhao Cc: Andrew Morton , Matthew Wilcox , Yin Fengwei , 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 , 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> 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 B3JfpUqcWwE7vUaYrHG1nw54pLUoPG6sAA7Mehl3nd4pZUALHwARAQABzSREYXZpZCBIaWxk ZW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zmTyBphDg/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=-0.9 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 26 Oct 2023 08:20:13 -0700 (PDT) [...] >>> Hi, >>> >>> I wanted to remind people in the THP cabal meeting, but that either >>> didn't happen or zoomed decided to not let me join :) > > I didn't make it yesterday either - was having to juggle child care. I think it didn't happen, or started quite late (>20 min). > >>> >>>> >>>> It's been a week since the mm alignment meeting discussion we had around >>>> prerequisites and the ABI. I haven't heard any further feedback on the ABI >>>> proposal, so I'm going to be optimistic and assume that nobody has found any >>>> fatal flaws in it :). >>> >>> After saying in the call probably 10 times that people should comment >>> here if there are reasonable alternatives worth discussing, call me >>> "optimistic" as well; but, it's only been a week and people might still >>> be thinking about this/ >>> >>> There were two things discussed in the call: >>> >>> * Yu brought up "lists" so we can have priorities. As briefly discussed >>> in the call, this (a) might not be needed right now in an initial >>> version; (b) the kernel might be able to handle that (or many cases) >>> automatically, TBD. Adding lists now would kind-of set the semantics >>> of that interface in stone. As you describe below, the approach >>> discussed here could easily be extended to cover priorities, if need >>> be. >> >> I want to expand on this: the argument that "if you could allocate a >> higher order you should use it" is too simplistic. There are many >> reasons in addition to the one above that we want to "fall back" to >> higher orders, e.g., those higher orders are not on PCP or from the >> local node. When we consider the sequence of orders to try, user >> preference is just one of the parameters to the cost function. The >> bottom line is that I think we should all agree that there needs to be >> a cost function down the road, whatever it looks like. Otherwise I >> don't know how we can make "auto" happen. I agree that there needs to be a cost function, and as pagecache showed that's independent of initial enablement. > > I don't dispute that this sounds like it could be beneficial, but I see it as > research to happen further down the road (as you say), and we don't know what > that research might conclude. Also, I think the scope of this is bigger than > anonymous memory - you would also likely want to look at the policy for page > cache folio order too, since today that's based solely on readahead. So I see it > as an optimization that is somewhat orthogonal to small-sized THP. Exactly my thoughts. The important thing is that we should plan ahead that we still have the option to let the admin configure if we cannot make this work automatically in the kernel. What we'll need, nobody knows. Maybe it's a per-size priority, maybe it's a single global toggle. > > The proposed interface does not imply any preference order - it only states > which sizes the user wants the kernel to select from, so I think there is lots > of freedom to change this down the track if the kernel wants to start using the > buddy allocator's state as a signal to make its decisions. Yes. [..] >>> Jup, same opinion here. But again, I'm very happy to hear other >>> alternatives and why they are better. >> >> I'm not against David's proposal but I want to hear a lot more about >> "lots of flexibility for growth" before I'm fully convinced. > > My point was that in an abstract sense, there are properties a user may wish to > apply individually to a size, which is catered for by having a per-size > directory into which we can add more files if/when requirements for new per-size > properties arise. There are also properties that may be applied globally, for > which we have the top-level transparent_hugepage directory where properties can > be extended or added. Exactly, well said. > > For your case around tighter integration with the buddy allocator, I could > imagine a per-size file allowing the user to specify if the kernel should allow > splitting a higher order to make a THP of that size (I'm not suggesting that's a > good idea, I'm just pointing out that this sort of thing is possible with the > interface). And we have discussed how the global enabled prpoerty could be > extended to support "auto" [1]. > > But perhaps what we really need are lots more ideas for future directions for > small-sized THP to allow us to evaluate this interface more widely. David R. motivated a future size-aware setting of the defrag option. As discussed we might want something similar to shmem_enable. What will happen with khugepaged, nobody knows yet :) I could imagine exposing per-size boolean read-only properties like "native-hw-size" (PMD, cont-pte). But these things require much more thought. -- Cheers, David / dhildenb