Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1306838rdb; Mon, 2 Oct 2023 05:59:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFBG52SmFJOSZERK2ZTWhaP1DTeTEI8EtfTRDyp/fkEA/hBGiO+3BRHJVtC9rQYNgA5juw3 X-Received: by 2002:a05:6a00:10c9:b0:68e:487c:c4b7 with SMTP id d9-20020a056a0010c900b0068e487cc4b7mr10069347pfu.11.1696251554145; Mon, 02 Oct 2023 05:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696251554; cv=none; d=google.com; s=arc-20160816; b=imWRtziN6TMBo55MLyNt3uQm6QwvkXjcXS4HiAJSto1FTP3G4JoZ6F43/MlGWr4cT2 MWTVezOF9reVf+QkfrA8l0QgGvVrUPqWAJOdkIg0YWIYeD/FVdAOPEHEIZfi260bNT8D y5p4CzNTJlCUAWkYr/9Dm0DUnjK3Dp2Gn/dpAytjGx/yR/rqF2Mmt809SPxr7f1k65UX W2NJb7lgfm40KywJnqEP6G7pGWtOE/uXgJqJfgvkBXrFXvJuxpLdLgeVr/gWrHVheiEm gvw3ue9JLrUa1ZYr8jWjpwJ7Chg8BwwDo53E6+0vjF3+lHxgL8B9DfdAfCLWDP5EYWAR 3DyA== 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=Jj9dEYbZ+hLhrqn7lx+LQ9YajTH4CVH6Vbv6rpw3xTQ=; fh=ksJErlrb+0nC1TpOffPQfGK/fkdKWnP5p0JTWQcZibY=; b=tnEcJIa+9un6FQ27Qi58KFmYghi+tvZdF33ujN4t2afQyGUosycLFaICGpCX3H4B8B WikYONluUd00XGZPufUL8rZNHzUOI2j7onOm1Ud2TPvTQo3XDZC8jWngwgvejfv+Pobr f1OHYJ6LKCqOqwNTaFpts+DyGmlYLrbN+yq7JK35l3ycevPk3gyCqSMJob+bU8kwMLH2 XiajyZwt2XVReWePoGLkvgiKxNZULJkel74zuRlJmij5Av8snU9Cu7g3ezUfLFhTum4D 1kl+VyAJPbOtCac3sFCSaf3GuEeYImwEQTIIzHZAWgU5/O0E15QchfrCvulN+LLPjA/v Iizg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p20-20020a056a000b5400b00690bd178205si28482523pfo.215.2023.10.02.05.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 05:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 9CD8E8098B82; Mon, 2 Oct 2023 05:33:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237015AbjJBMdE (ORCPT + 99 others); Mon, 2 Oct 2023 08:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236192AbjJBMdD (ORCPT ); Mon, 2 Oct 2023 08:33:03 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF51EAC for ; Mon, 2 Oct 2023 05:32:59 -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 ABF03C15; Mon, 2 Oct 2023 05:33:37 -0700 (PDT) Received: from [10.57.66.79] (unknown [10.57.66.79]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 545583F59C; Mon, 2 Oct 2023 05:32:56 -0700 (PDT) Message-ID: <5caf5aee-9142-46f6-9a04-5b6e36880b21@arm.com> Date: Mon, 2 Oct 2023 13:32:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 0/4] Enable >0 order folio memory compaction Content-Language: en-GB To: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , "Yin, Fengwei" , Yu Zhao , Vlastimil Babka , Johannes Weiner , Baolin Wang , Kemeng Shi , Mel Gorman , Rohan Puri , Mcgrof Chamberlain , Adam Manzanares , John Hubbard References: <20230912162815.440749-1-zi.yan@sent.com> From: Ryan Roberts In-Reply-To: <20230912162815.440749-1-zi.yan@sent.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 05:33:10 -0700 (PDT) Hi Zi, On 12/09/2023 17:28, Zi Yan wrote: > From: Zi Yan > > Hi all, > > This patchset enables >0 order folio memory compaction, which is one of > the prerequisitions for large folio support[1]. It is on top of > mm-everything-2023-09-11-22-56. I've taken a quick look at these and realize I'm not well equipped to provide much in the way of meaningful review comments; All I can say is thanks for putting this together, and yes, I think it will become even more important for my work on anonymous large folios. > > Overview > === > > To support >0 order folio compaction, the patchset changes how free pages used > for migration are kept during compaction. Free pages used to be split into > order-0 pages that are post allocation processed (i.e., PageBuddy flag cleared, > page order stored in page->private is zeroed, and page reference is set to 1). > Now all free pages are kept in a MAX_ORDER+1 array of page lists based > on their order without post allocation process. When migrate_pages() asks for > a new page, one of the free pages, based on the requested page order, is > then processed and given out. > > > Optimizations > === > > 1. Free page split is added to increase migration success rate in case > a source page does not have a matched free page in the free page lists. > Free page merge is possible but not implemented, since existing > PFN-based buddy page merge algorithm requires the identification of > buddy pages, but free pages kept for memory compaction cannot have > PageBuddy set to avoid confusing other PFN scanners. > > 2. Sort source pages in ascending order before migration is added to > reduce free page split. Otherwise, high order free pages might be > prematurely split, causing undesired high order folio migration failures. Not knowing much about how compaction actually works, naively I would imagine that if you are just trying to free up a known amount of contiguous physical space, then working through the pages in PFN order is more likely to yield the result quicker? Unless all of the pages in the set must be successfully migrated in order to free up the required amount of space... Thanks, Ryan