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 3138AD5E122 for ; Sat, 9 Nov 2024 07:12:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 41B746B0092; Sat, 9 Nov 2024 02:12:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CAB66B0098; Sat, 9 Nov 2024 02:12:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 292436B0099; Sat, 9 Nov 2024 02:12:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0B95C6B0092 for ; Sat, 9 Nov 2024 02:12:31 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 87AD91A0545 for ; Sat, 9 Nov 2024 07:12:30 +0000 (UTC) X-FDA: 82765687410.12.099930C Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by imf19.hostedemail.com (Postfix) with ESMTP id 39D891A000E for ; Sat, 9 Nov 2024 07:11:39 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=VbpfmhGH; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf19.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.133 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731136288; a=rsa-sha256; cv=none; b=0NvRe41WGOSXfOgUR4hZFkNFsyJT0hL+6EL2E/XGtJRq/r8SYww4RMc+nbozAd4NLz4T1+ ibyhwwQ32NQkWpeEzz90apC/PgrcAXx6ETo9njb1kDSuYweUeok2wWNPdyk/YUecA9CE7J cn0DbQAqrxJkmMYcR8Ucfqx2B2WmaHA= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=VbpfmhGH; dmarc=pass (policy=none) header.from=linux.alibaba.com; spf=pass (imf19.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.133 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731136288; 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:dkim-signature; bh=A6UqBYVCS/TOTFjQt3Tzhr5BGkUP2D8w/Z3WsnhNXlI=; b=ekqxpUsca6YliEsbhhRb58P/+xaiNom9NOoLp8Gr/myK/fEgJE/ioTvbYag7ywd25JzJ+g IMQmPbbwylu3Bzd9AXaNr5A/OLdaBVXg/TZQmE0PyIDbaYvWql4mjYjVDm/06cabe0zgy/ tKS0NxUY2wY+facmx/msGJOZ0IEFfDI= DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1731136344; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=A6UqBYVCS/TOTFjQt3Tzhr5BGkUP2D8w/Z3WsnhNXlI=; b=VbpfmhGH/b/LoahYw/of4FTD7LfDHwVB6j73EFwjcxgVUmUMirrH3SHomYjtHrReiQ52DqZSGvO1W4IWpDAneDQrU3h/yFg6MKASLRVitDsPnkmotdnIm9z4Eq3bXraiZ4K92UTADs290N4BFzXOCQEP8kRFXugL96v8O6a9BJo= Received: from 30.15.226.209(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WJ.rpS._1731136341 cluster:ay36) by smtp.aliyun-inc.com; Sat, 09 Nov 2024 15:12:23 +0800 Message-ID: Date: Sat, 9 Nov 2024 15:12:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/4] Support large folios for tmpfs To: David Hildenbrand , akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, wangkefeng.wang@huawei.com, 21cnbao@gmail.com, ryan.roberts@arm.com, ioworker0@gmail.com, da.gomez@samsung.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <3d49fbf8-866f-485b-b7fa-a89bbfb3cd7c@redhat.com> From: Baolin Wang In-Reply-To: <3d49fbf8-866f-485b-b7fa-a89bbfb3cd7c@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Queue-Id: 39D891A000E X-Rspamd-Server: rspam11 X-Stat-Signature: qbumusjgqxaqnkwfgn79sch1uio85doe X-HE-Tag: 1731136299-480821 X-HE-Meta: U2FsdGVkX1/q9/te1p5wz0jfDSLVxImXak8QAd3J65mOM0gKqzeXYdHt0IuCK+v2Vbh70OKpYQidCdqvUnUezUnUx0zf/MSOaKAV/wzGkqhH6WCA1GamcgCJY4xkeaR9e7GfKUxAvYUi25Yvi26Yt6m4bcxwS/JGizthGJ2hiIasIub3vviq6OHe62jkXJ/YZalSBW1wpUT1K+ld5rJ8fCZlyHN+ivLzTU1dVyGZiqE0VCoc6zhs5RWcqyHu1eQUzMl8sitAOmy4RjKwOlukemwESMbeU4HITtpGSZUO+VYciUbBCVsExF464aflhemTBJS+n8x7U83X61VYAt8VX5CnfjIm6UK/ZDH6h2rnIeXY8bEAJcUXLo0x6D1qWddzb963fZkzd39cbRhEEyO2ukTVFXnD2tLSmBpHjVJ9MQcowM3weYRYVD+Di5yJU3yPiOkqIaTmkqY/Kfs3GlVRRzBKufAGw6rnV9Vckg79qCW1CJkIXMV6aVV7kJuvDaKaEDh6urHZKR34NyfmrN60/vpwrdoL0E3ne5OfDMioAqt+QcaPuzKUeJzm3j1aT6LZLZ4rK1HrQptxHjfZJPqVR6GcbuQFZ5fdgaWCQ4euK6KSfnB6EH6P12EZKbWAn1fqjgquG5tu3Az8Gj0b+ZEwYXFLlkVBsp5hyeyjxb3JbSkxzTVIIeSe3j35v/9pLHOl6XYGMeCJLJktlRSdx0ZuQwzQqQUxX/l5+ty18NslqozQaM91yfpEf+4eBKjXSCn1KFKfNE1qtcV3r8WxW4GPnoYfe3iN/6/ZVpCrUCOzK3GsErZMSEJZDhNdtooytZZe1uAeFoQh0cjKHDq1mf3sQywlI8wl50O2pk0AG9fccgsXDN2vumzrL8+tW8rvSQfpMZvX+zZl3sFamdJcqeYrjid/ZtJ6yRcuHdoJnHrVL6xYX8/RoVotVfJCMwDuovtShw0A1fFD2FOdP3rW9r9 p5+4GoXZ 8s4SAj3BeIKiaxWSgSwQwzWIMig9q9HX2ndm1pLxjUwexYfaNup6eSu0L0ie9anbOMpd93wBUhpE7DEv/nHiLgqfVqaAHT51fFujYVcsQXz/JB2PzMmw5H5Qf1/WFatOliPgvO6azBVd39wbkWs3NatNVAtLLL1ahwdSH9iE2ZJqxp5tNcJfsWH/WGd59yuN6ytDmQliqDG1undK7C12Gys2DqWs0FR8RCxq2Mp7/9ScQQCrPwRpGRJwgg6MMZkZoeap0 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/11/8 23:30, David Hildenbrand wrote: > On 08.11.24 05:12, Baolin Wang wrote: >> Traditionally, tmpfs only supported PMD-sized huge folios. However >> nowadays >> with other file systems supporting any sized large folios, and extending >> anonymous to support mTHP, we should not restrict tmpfs to allocating >> only >> PMD-sized huge folios, making it more special. Instead, we should allow >> tmpfs can allocate any sized large folios. >> >> Considering that tmpfs already has the 'huge=' option to control the huge >> folios allocation, we can extend the 'huge=' option to allow any sized >> huge >> folios. The semantics of the 'huge=' mount option are: >> >> huge=never: no any sized huge folios >> huge=always: any sized huge folios >> huge=within_size: like 'always' but respect the i_size >> huge=advise: like 'always' if requested with fadvise()/madvise() >> >> Note: for tmpfs mmap() faults, due to the lack of a write size hint, >> still >> allocate the PMD-sized huge folios if huge=always/within_size/advise >> is set. > > So, no fallback to smaller sizes for now in case we fail to allocate a > PMD one? Of course, this can be added later fairly easily. Right. I have no strong preference on this. If no one objects, I can add a fallback to smaller large folios if the PMD sized allocation fails in the next version. >> Moreover, the 'deny' and 'force' testing options controlled by >> '/sys/kernel/mm/transparent_hugepage/shmem_enabled', still retain the >> same >> semantics. The 'deny' can disable any sized large folios for tmpfs, while >> the 'force' can enable PMD sized large folios for tmpfs. >> >> Any comments and suggestions are appreciated. Thanks. >> >> Hi David, >> I did not add a new Kconfig option to control the default behavior of >> 'huge=' >> in the current version. I have not changed the default behavior at this >> time, and let's see if there is a need for this. > > Likely we want to change the default at some point so people might get a > benefit in more scenarios automatically. But I did not investigate how > /tmp is mapped as default by Fedora, for example. Personally, adding a cmdline to change the default value might be more useful than the Kconfig. Anyway, I still want to investigate if there is a real need.