Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2785804rda; Wed, 25 Oct 2023 12:12:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeOkSSQ8C4UVBHwUDxquWYQCD6b1aYkB4KSG/QPJNNCFvky55Hg3EyhjjM8dHM4I096TQO X-Received: by 2002:a25:d88b:0:b0:d9c:7f5d:e202 with SMTP id p133-20020a25d88b000000b00d9c7f5de202mr15667635ybg.36.1698261152595; Wed, 25 Oct 2023 12:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698261152; cv=none; d=google.com; s=arc-20160816; b=HLYerHWJ+eF3wW1HLRSfm8fxXMdag5fqhb79OzYoyCY+hve4IXle/Fph4A9dxG1m/i pYupBgipY5CjafArjCaZc5Z3ZXFnUzUZVreeiAXB1PDCjiWyl5sPKfVu9Dg+sAfzlbWZ Ws1bwsGJ+uov/6rE90QPHTZws1gcaD9DQPnDBW9+z9B9hiHd1Rzre8NId3dzoZ/29i5t LM0lWSroOyovQV5T3fYWU5fzOcpPw4RR7ep/yTU4NAZNlUkE6u0g3c75E3bxHat/gnn4 pvQj7i2rbAC7X0H6JNvQ27AlnKmtC2jasixozntKwQbuSQjn2n9JEF5z45wzkkocnY/o hXtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MQsXRm/26AnMKfle1hOvoePNzv6mvpNR6kguNEXwq5g=; fh=lAFjZl+rP6HD6bEXdKQET/0h9mYs06qGwwHivSs9T84=; b=AoWwT7TfIb0BWjpUXFEDac0B2VpwiAawr9zg4CkgbM82RGYUlmu0/nVTARnK+h0/KM 8Jm/CctwzPjnM8WkcX6YHrdG54xgv/491T4SNrDk6jdtlwb+zH9StpxNH0QN6Ks6w+X3 nYeiB4WP/ERjfvpUc9CbZXI8MLyq7wLXDOnSauOXGCeqaYDHkY0LSPhXXpxbwqNEsL8R 87Xa6KPFc2VJEWbcYHInjJIro9AgqpOPxHfv/3CVMeTMkzQ0kbFO7YmlHtqFhp8hqTWv Kc1aO4vEGBssN3QSu+Y8wJJLcvLsNmFEGxd0sOUU1Se58HmlsGm42nomq/bTdjAf2JhM pHsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=3MBCiFOX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id t7-20020a056902124700b00d84c1c2b6a6si14570518ybu.739.2023.10.25.12.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 12:12:32 -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=@google.com header.s=20230601 header.b=3MBCiFOX; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 632AF8023926; Wed, 25 Oct 2023 12:12:29 -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 S234055AbjJYTMH (ORCPT + 99 others); Wed, 25 Oct 2023 15:12:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjJYTMG (ORCPT ); Wed, 25 Oct 2023 15:12:06 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD4ABBB for ; Wed, 25 Oct 2023 12:12:03 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-41cb7720579so46261cf.1 for ; Wed, 25 Oct 2023 12:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698261123; x=1698865923; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MQsXRm/26AnMKfle1hOvoePNzv6mvpNR6kguNEXwq5g=; b=3MBCiFOXBQj7wLOmbS4x3qZZQb8H6SPc+jS2JYxiytH0qB+pfxgDN9gs6/uCDwtDum 46hwBK21ij+DeVZpoZIEapJzInF4p6Un/J8A+ywl+VjQKjRMsJlkNPjMpHnoPhxVCB0Z wMSctz0Mqm8kxp/YFjBKPDv4RsKlrt5dEIWRrnPO4btOlTLy5FeIxPxiXugZVCF3MAeC BnFeQBR2fxe7jSjuSUpWrJjNBXJEEXz0ANZN8vLSxR34K8NycVC4Yy8QSvxwylt1mI73 9aA3dvqd+yHVU4ISwZD17b7wftEJfv8qD151EcWxz8BgQ9BZR/Vr34Kyo2mLBsjIyxvY jDoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698261123; x=1698865923; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MQsXRm/26AnMKfle1hOvoePNzv6mvpNR6kguNEXwq5g=; b=FDhQDknGgcyF0x4G6xzTPUNvS2lZjzSKod9bGWEx7IduwEcHOWXGVA8+CMHPT50Lz1 9lJnKzqq0nYG7c2ipUg97brF0zX34a34TFqS9+YAAE8jle+XFn/n+Q2C4JlY+2d3C9O8 WFcAglujPyHYmsg5gGi6iwgTiZ6ZngPF8ftH96C0KsYGi3jQdzre9gLU1ywnrknTLoUx xjxPw/lelSHIBvDcKEqSBjd+9l7wUeNLh89vvF9L3XAtkTvYjC6Z3nvA+Rz0an4E08hZ Pom0BsnT6KbG9OhGjtk3H4faIQCKMHtD7hpjYcQwfoKmbkpO8+/LdQHSJMHPuBVdfh0l +prw== X-Gm-Message-State: AOJu0Yzq5/NrFLkvRDlDX+W8pgrdmQ/ZUZIf+Q9+V2VJzClTDSjHEWxS dShBYswAAZoLg+V2OZONrJ7HlB0i0KwzLbdQRy3O2A== X-Received: by 2002:ac8:7cad:0:b0:41e:2984:6dba with SMTP id z13-20020ac87cad000000b0041e29846dbamr257820qtv.3.1698261122754; Wed, 25 Oct 2023 12:12:02 -0700 (PDT) MIME-Version: 1.0 References: <20230929114421.3761121-1-ryan.roberts@arm.com> <6d89fdc9-ef55-d44e-bf12-fafff318aef8@redhat.com> In-Reply-To: From: Yu Zhao Date: Wed, 25 Oct 2023 13:11:24 -0600 Message-ID: Subject: Re: [PATCH v6 0/9] variable-order, large folios for anonymous memory To: David Hildenbrand , Ryan Roberts 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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]); Wed, 25 Oct 2023 12:12:29 -0700 (PDT) On Wed, Oct 25, 2023 at 12:47=E2=80=AFPM David Hildenbrand wrote: > > On 25.10.23 18:24, Ryan Roberts wrote: > > On 20/10/2023 13:33, Ryan Roberts wrote: > >> On 06/10/2023 21:06, David Hildenbrand wrote: > >>> On 29.09.23 13:44, Ryan Roberts wrote: > >>>> Hi All, > >>> > >> > >> [...] > >> > >>>> NOTE: These changes should not be merged until the prerequisites are= complete. > >>>> These are in progress and tracked at [7]. > >>> > >>> We should probably list them here, and classify which one we see as s= trict a > >>> requirement, which ones might be an optimization. > >>> > >> > >> Bringing back the discussion of prerequistes to this thread following = the > >> discussion at the mm-alignment meeting on Wednesday. > >> > >> Slides, updated following discussion to reflect all the agreed items t= hat are > >> prerequisites and enhancements, are at [1]. > >> > >> I've taken a closer look at the situation with khugepaged, and can con= firm that > >> it does correctly collapse anon small-sized THP into PMD-sized THP. I = did notice > >> though, that one of the khugepaged selftests (collapse_max_ptes_none) = fails when > >> small-sized THP is enabled+always. So I've fixed that test up and will= add the > >> patch to the next version of my series. > >> > >> So I believe the khugepaged prerequisite can be marked as done. > >> > >> [1] > >> https://drive.google.com/file/d/1GnfYFpr7_c1kA41liRUW5YtCb8Cj18Ud/view= ?usp=3Dsharing&resourcekey=3D0-U1Mj3-RhLD1JV6EThpyPyA > > > > Hi All, > > 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 :) > > > > > It's been a week since the mm alignment meeting discussion we had aroun= d > > 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 foun= d 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. > * Hugh raised the point that "bitmap of orders" could be replaced by > "added THP sizes", which really is "bitmap of orders" shifted to the > left. To configure 2 MiB + 64Kib, one would get "2097152 + 65536" =3D > "2162688" or in KiB "2112". Hm. I'm not a big fan of the "bitmap of orders" approach, because it doesn't address my concern above. > Both approaches would require single-option files like "enable_always", > "enable_madvise" ... which I don't particularly like, but who am I to jud= ge. > > > > > > Certainly, I think it held up to the potential future policies that Yu = Zhou > > cited on the call - the possibility of preferring a smaller size over a= bigger > > one, if the smaller size can be allocated without splitting a contiguou= s block. > > I think the suggestion of adding a per-size priority file would solve i= t. And in > > general because we have a per-size directory, that gives us lots of fle= xibility > > for growth. > > 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. Why do I need more convincing? When I brought up that we need to consider the priority of each order and the potential need to fall back to higher orders during the meeting, I got the impression people were surprised why we want to fall back to higher orders. TBH, I was surprised too that this possibility was never considered. I missed today's THP meeting too but I'll join next time and if anyone has more ideas on this, we can spend some time discussing it, especially on how LAF should cooperate with the page allocator to make better decisions.