From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B2AFD206AB for ; Wed, 16 Oct 2024 07:49:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B96FE6B007B; Wed, 16 Oct 2024 03:49:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B47356B0082; Wed, 16 Oct 2024 03:49:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0E8E6B0083; Wed, 16 Oct 2024 03:49:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 821686B007B for ; Wed, 16 Oct 2024 03:49:40 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 47A2F121B26 for ; Wed, 16 Oct 2024 07:49:31 +0000 (UTC) X-FDA: 82678690710.05.942190A Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf23.hostedemail.com (Postfix) with ESMTP id 2BAAA140015 for ; Wed, 16 Oct 2024 07:49:31 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729064930; h=from:from:sender: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; bh=YS5NoA9hXi7HywtyrLRZLdfiQRYYJtfm4bWWeXIF338=; b=bZYoAOaUPqi6T6+WDkUsNVnWywZIoNMcZ2bXrBE9XlXj44BtUozZeZyU/70xslakkCJcpS qIIWAQvYbKI0oMyIYVVqtJ6cVnRCo0Luuvge5psUq4St1pOYgYM6+PtjHzaDVLqWADBRWy fvQd+BZGtRSs+gBgevOlU2f+o8E32DU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729064930; a=rsa-sha256; cv=none; b=6tpFe4snsOfCFLZ62NE93OGg2ZX/FbOCHFFB58wXDu6VnabHX5iEZ+CPjG1DqJMYCYyh6w UEAPB9GUWVifaNuTYU0UsRUxVmJIt7Aep8oCMhvFiwjXWmK+HdcwAjbja3pzNlaVEUJc5N RE0dPCpB3wA9jbItLl3sFwL8Xwn4qfQ= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XT3430dfqz1j9xG; Wed, 16 Oct 2024 15:48:19 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id EF283180042; Wed, 16 Oct 2024 15:49:32 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 16 Oct 2024 15:49:32 +0800 Message-ID: <007880ac-d73f-4eef-9978-a4f844338522@huawei.com> Date: Wed, 16 Oct 2024 15:49:31 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 0/4] Support large folios for tmpfs To: Baolin Wang , , CC: , , <21cnbao@gmail.com>, , , , , References: Content-Language: en-US From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspam-User: X-Stat-Signature: c3b84tzs39nsgie1nk86zhmzntzn4dk8 X-Rspamd-Queue-Id: 2BAAA140015 X-Rspamd-Server: rspam11 X-HE-Tag: 1729064971-242580 X-HE-Meta: U2FsdGVkX1+NIghSkl1EVPbpjysb8StrQUBTcSpeoMNKfDGry7LHjtrzv/HOoBAABWAihnGJx+8jJvLVxmDA5q9ZpydlARmGgowW1uN9tYnjFdiV1qwUgtX3AaFd3KxnOIulkT7sWh0iq4QRtUPqGZGi4eGTqqimKibPLNHvDR4XBx+R0UrYS8lFd6VZnuV8Ty22Ip4isp2oR5+Dg1/4O3HDmXBksHUHsR0z93DaHXv7lbmGFCxmcvKmZYgVR7U6IZlH0M5FTdZQ8XSX+pC8RMjEDawCjQ4WlPl+yraBkSU9vENkqb1Im3+xcap2jwDIR2feTgoIydQjjQFhk+NcMvbzR9CNSO+EU+KH6+BOH5WApMiFBSg1nnE98TdsAyatNbTIT3p3FOJ3g7BEgcYdoDdueXyQihAoBgkSjZ4FWS5LAmKjh2ZMxDw4BVSOEH9vxdiWHGdo7T3sHy4tMo9YbcPSiChBjgaLXZsJm7e2Gbe6/mXYZ49dTvCG6IAej7m/Nl8j10RJgbLk0HMoeU5DU6jRtqrbyUqM4dISPfpT925N4039k+80qh1ywJGfCd5X4XouSuv/a3uHe9//suPwJthfbILB09+u9eRgywh4R650qp17Tm5a3h1GuHxscQMJ2gBh2Oney6ntB5gx7qw64/0TmFucV3T5qoUQMfjl39miCL0QuT6OEC9OsdG3d9BkzwiUlt6SPADqRPxurLZKaXI+13Gbs5ya/keIaEYmrD5CJhFarOnQ2+At0OZZEr0/RuDkQ5fhrpsYsXhiQdTBALPlr9r3yc9EgrJXN77EzJXRxkEAyPdEbE/fGpPIHWgZXDfMg2jiHXQo0GoTjG+hbimgWI01zBNwgWBWR109MXaJ6pY9RuPs2JA7kERSTYMsccSDxB4x3BAx12ES2c4D4ZplGFYMjpiMTnaNZ6lcC8rmgzzwhL+uHDNOWTi+wueNXd9bRrS/NCfKk69Eooq Tml30suF rMpTL7Tm9xJ0bo6x1Wi3CHw3SxKYSnevS37zOAGK6W1Oqs53sfB+MDp5lpkDDwdR4cksb8C37dr6cGQU0T1XulLn2h6wKCXhKsMHL2EBgrFWgz58zxuCGI+Ft9Ka0tX7K78xC6a73MqeUb8Q4ISD1oQFlkvFz8/pTNlFOifwoSLuR6w8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/10/10 17:58, Baolin Wang wrote: > Hi, > > This RFC patch series attempts to support large folios for tmpfs. > > Considering that tmpfs already has the 'huge=' option to control the THP > allocation, it is necessary to maintain compatibility with the 'huge=' > option, as well as considering the 'deny' and 'force' option controlled > by '/sys/kernel/mm/transparent_hugepage/shmem_enabled'. > > Add a new huge option 'write_size' to support large folio allocation based > on the write size for tmpfs write and fallocate paths. So the huge pages > allocation strategy for tmpfs is that, if the 'huge=' option > (huge=always/within_size/advise) is enabled or the 'shmem_enabled' option > is 'force', it need just allow PMD sized THP to keep backward compatibility > for tmpfs. While 'huge=' option is disabled (huge=never) or the 'shmem_enabled' > option is 'deny', it will still disable any large folio allocations. Only > when the 'huge=' option is 'write_size', it will allow allocating large > folios based on the write size. > > And I think the 'huge=write_size' option should be the default behavior > for tmpfs in future. Could we avoid new huge= option for tmpfs, maybe support other orders for both read/write/fallocate if mount with huge? > > Any comments and suggestions are appreciated. Thanks. > > Changes from RFC v2: > - Drop mTHP interfaces to control huge page allocation, per Matthew. > - Add a new helper to calculate the order, suggested by Matthew. > - Add a new huge=write_size option to allocate large folios based on > the write size. > - Add a new patch to update the documentation. > > Changes from RFC v1: > - Drop patch 1. > - Use 'write_end' to calculate the length in shmem_allowable_huge_orders(). > - Update shmem_mapping_size_order() per Daniel. > > Baolin Wang (4): > mm: factor out the order calculation into a new helper > mm: shmem: change shmem_huge_global_enabled() to return huge order > bitmap > mm: shmem: add large folio support to the write and fallocate paths > for tmpfs > docs: tmpfs: add documention for 'write_size' huge option > > Documentation/filesystems/tmpfs.rst | 7 +- > include/linux/pagemap.h | 16 ++++- > mm/shmem.c | 105 ++++++++++++++++++++-------- > 3 files changed, 94 insertions(+), 34 deletions(-) >