Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp30952686rwd; Thu, 6 Jul 2023 13:14:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJTOPDv/1DcrRACMKIMywdWpqNbhEq941q51rmVFKYjxmWwr1quyU0rbo5lGc0NwxnJyxA X-Received: by 2002:a05:6a20:138c:b0:126:a5e3:3927 with SMTP id hn12-20020a056a20138c00b00126a5e33927mr2264461pzc.8.1688674477983; Thu, 06 Jul 2023 13:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688674477; cv=none; d=google.com; s=arc-20160816; b=qnL5fYQe6DSrAFDXnysGSTngy96Nh2fQmZcqLL6Pd2W27YmGvO47Q7gNPO8gUiLvkw BFRFIrT/OUXwAgSIYm26x8PlbGovyKo6S0CcekI1SaPXxnlmPudpquwZ3+JEHI+EC/qN yoSvyL9uY0XAeMNYUhvKtP3iYgATdOhVvrPXxcpqS0KQfORd4m7mMrhMhMVdhqCjxWtK tG3BoslNMfrZmXhMGjigB71tM44sLz0wk1g/5my7uB8JYA1ZiLUQV6510xtHAEsuJtW7 I1SMQfx3xzpnoyVzTZCVhulmnBYAt8cO2KFOE1NW5I0P40QxokGB5Abkjo0Sl7OVAZOS Uoig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0wxmw1h/+sc7ZkGjLi6C59U1J1wukIjy+nrYU+ZKh7s=; fh=4/0yrhY+CFp1Eiv8sXr/jBiYaZK6v2NTyzeG+vPYvJI=; b=Fi9rk7KTpP+Vb306+Od34yupj5gKlU6Aj2EVLVVpdGDMuHBTOAyA/XmBbna59GReMU Pe4BEoWIGJZdW/7oC9QhwZJlLdUkkIWPwDK5GTXW8emQE6f+j/p2xMWvCuoBHB5yQcla 0EEB6Wr1R/SQrFThMBTnQOklrgcLl8nIU3cQvvllDO3dg1en3CJqkVht+okBMYkPLjil HvyQ4K9kt8d415pQRNBTkggAeOJuxB9IWQXGU4nKEnuPmIt8NH3ZMf30nbawOaLL1NOG Doxs303/IBxcWxCVmly1Vw4fwi5y9Nk06vc78ltavWLj/4eDdwB/svYR855OzRMbHz6/ l4Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kdCQhoZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s133-20020a632c8b000000b0054f71faf5aasi2088961pgs.581.2023.07.06.13.14.25; Thu, 06 Jul 2023 13:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=kdCQhoZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbjGFTdm (ORCPT + 99 others); Thu, 6 Jul 2023 15:33:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbjGFTdl (ORCPT ); Thu, 6 Jul 2023 15:33:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9641BFF for ; Thu, 6 Jul 2023 12:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0wxmw1h/+sc7ZkGjLi6C59U1J1wukIjy+nrYU+ZKh7s=; b=kdCQhoZRlP+51y/fm7OjLLXVUU MgnblWPjJeWegHqTxc2bW0g5qPTx6NwuwQCIsIJvqXFS5nAz/OseFxEljm4ZSBVx8ZlGklmk3j+yG paqL/h+GOK0chawhP5ibXNRWszLaLGTJyhS9KS4VaS0kGn47IFSlMOdqcxAbPvjLFkao/7Loxweav zMDn7iZYkB5P64QhmKHix+FMnDemyQSDfb0d1ZqkosI0J7H/lbDLI1aJtQ7gsetgEhHDK/r3Cdsu2 RKI9G5Uq2Ymp6A4iOE5hCZOGQCfwbDECKx7oEJ4/xr55VGX0rlMmt/CEdFA3HhBJvEKIA8HxXwpja SxnltGVw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qHUj7-00BLN7-QK; Thu, 06 Jul 2023 19:33:17 +0000 Date: Thu, 6 Jul 2023 20:33:17 +0100 From: Matthew Wilcox To: Yu Zhao Cc: Ryan Roberts , Andrew Morton , "Kirill A. Shutemov" , Yin Fengwei , David Hildenbrand , Catalin Marinas , Will Deacon , Anshuman Khandual , Yang Shi , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 3/5] mm: Default implementation of arch_wants_pte_order() Message-ID: References: <20230703135330.1865927-1-ryan.roberts@arm.com> <20230703135330.1865927-4-ryan.roberts@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On Tue, Jul 04, 2023 at 08:07:19PM -0600, Yu Zhao wrote: > > - On arm64 when the process has marked the VMA for THP (or when > > transparent_hugepage=always) but the VMA does not meet the requirements for a > > PMD-sized mapping (or we failed to allocate, ...) then I'd like to map using > > contpte. For 4K base pages this is 64K (order-4), for 16K this is 2M (order-7) > > and for 64K this is 2M (order-5). The 64K base page case is very important since > > the PMD size for that base page is 512MB which is almost impossible to allocate > > in practice. > > Which case (server or client) are you focusing on here? For our client > devices, I can confidently say that 64KB has to be after 16KB, if it > happens at all. For servers in general, I don't know of any major > memory-intensive workloads that are not THP-aware, i.e., I don't think > "VMA does not meet the requirements" is a concern. It sounds like you've done some measurements, and I'd like to understand those a bit better. There are a number of factors involved: - A larger page size shrinks the length of the LRU list, so systems which see heavy LRU lock contention benefit more - A larger page size has more internal fragmentation, so we run out of memory and have to do reclaim more often (and maybe workload which used to fit in DRAM now do not) (probably others; i'm not at 100% right now) I think concerns about "allocating lots of order-2 folios makes it harder to allocate order-4 folios" are _probably_ not warranted (without data to prove otherwise). All anonymous memory is movable, so our compaction code should be able to create larger order folios.