Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2313775pxp; Mon, 21 Mar 2022 16:40:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXz+xUZo/3XGqFMySyv6rD+N/V0rkdxdKO0Any56a/f+zSsFmV3Skr4gvuMhQAxwei04GK X-Received: by 2002:a17:902:ecd1:b0:154:5393:aa7e with SMTP id a17-20020a170902ecd100b001545393aa7emr8100701plh.79.1647906046974; Mon, 21 Mar 2022 16:40:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647906046; cv=none; d=google.com; s=arc-20160816; b=qHBi8FsyICYcaDKV7bQXdx/lPYq5gyO5P+SLzZq+mnU1zk8+daHKhnTk+pyg5JzWW+ pekA7OOONVChL4WfGjwqbtShAVIfdIaiqfBwj8CT+bzCbPgFGJrz9Es20Ts8Eu6dTMk1 ntOyVoREZhzYnKnPC5m7CGEYFReQ83KQQHr6kHtwWyhIuOK+KVParhNbzrWvgP+YAKNn KmD9a/ZGlLeZbISGZcuUCsRhLo32UahaLK+96qamgFg3RkE/Es/389zCm1iQ5xjUG0RG Byh5NT4TAmfG3nkq4qoTJ0Bu8VGQ9giPJAXfZHxPRYcNCBC2CO1eZWcIiw1964SkS0sC VZ4g== 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:dkim-signature:date; bh=4OY/H+zb0RIXu5WxaVqPmTsIU0BzpBHr2Aoo03K23OQ=; b=J5Y9k0i+K4wm/VqtNg4MgqjnAC2IWhuKxKspc4M/NqBLsz36roo9tcYCRgXOexJRMX C5xXDDI5ZMHgHsvn5aIyclbeUZV/bA21edVGtmp+Rg8hB5PgR8+p7RUPWpXCDO5OuFgF CCauM2Ie7xyoPizW4jPgpEn9IdUg9Su8KpJNunKOSuDdxaqmun6slQ4fY34aLPI1j5YT F0Pq+LanUYUaWadz3nsrW1IRizwdtKBcGLwotYYGN7xV7XFmMD0SJkDZz/wb4T10uo/w QYj9RjRH4Nya9FtQV36LjwhJBcYw86z0OKEVaddHhZCs5H+PKjx5KzaefIQ9Re0DiVWe QI/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lWfBFFlw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e19-20020a630f13000000b003816043f155si14707717pgl.842.2022.03.21.16.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lWfBFFlw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 77B4740FE86; Mon, 21 Mar 2022 15:54:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230324AbiCUWy3 (ORCPT + 99 others); Mon, 21 Mar 2022 18:54:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbiCUWyT (ORCPT ); Mon, 21 Mar 2022 18:54:19 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A137380F70; Mon, 21 Mar 2022 15:33:00 -0700 (PDT) Date: Mon, 21 Mar 2022 15:32:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1647901979; 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: in-reply-to:in-reply-to:references:references; bh=4OY/H+zb0RIXu5WxaVqPmTsIU0BzpBHr2Aoo03K23OQ=; b=lWfBFFlwAImoY6uLwKWFs0S0tB3p39fYyxokhIeIaZPj4jja16BD+f2jryUMXCpvSoQH58 KeNgR9rDqZZ733hMRZ75cM3upum9/Xboyi1T1hrsp4FdNCyEUqd/OOG+FlIywmGiFjuF4e 0dwiI5FqWUCpfqADo77fjlQiIREimSI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Zi Yan Cc: Matthew Wilcox , linux-mm@kvack.org, Shuah Khan , Yang Shi , Miaohe Lin , Hugh Dickins , "Kirill A . Shutemov" , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [RFC PATCH 4/5] mm: truncate: split huge page cache page to a non-zero order if possible. Message-ID: References: <20220321142128.2471199-1-zi.yan@sent.com> <20220321142128.2471199-5-zi.yan@sent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220321142128.2471199-5-zi.yan@sent.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Mar 21, 2022 at 10:21:27AM -0400, Zi Yan wrote: > From: Zi Yan > > To minimize the number of pages after a huge page truncation, we do not > need to split it all the way down to order-0. The huge page has at most > three parts, the part before offset, the part to be truncated, the part > remaining at the end. Find the greatest common power of two multiplier of > the non-zero values of them as the new order, so we can split the huge > page to this order and keep the remaining pages as large and as few as > possible. Would you mind please to describe the algorithm in more details? Thanks!