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 5FC53D1A42F for ; Sat, 12 Oct 2024 03:59:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7D3B6B00A0; Fri, 11 Oct 2024 23:59:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2DF36B00A1; Fri, 11 Oct 2024 23:59:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF5E56B00A3; Fri, 11 Oct 2024 23:59:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B1C436B00A0 for ; Fri, 11 Oct 2024 23:59:47 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CFC76C1998 for ; Sat, 12 Oct 2024 03:59:41 +0000 (UTC) X-FDA: 82663596288.07.5A21BA4 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf02.hostedemail.com (Postfix) with ESMTP id 79F7D80016 for ; Sat, 12 Oct 2024 03:59:38 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Xf7ebWIm; spf=pass (imf02.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728705447; 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=UYj35hoGtiu9zkkHRVDTINPh/FPLkegdGt99B9GNDmw=; b=pi3YfW3na11hevV5qMUW4R9kZIy4Ij5QQKGxy6zzWM3cZ6CCblLxxPhPncCGfCXy3LVwq+ Ft0QD/Cf+etCgJMiiTj4XkCq3bE/+6frpHubpEfJ4PhBfeMEzF/YWkC+zdD6J3Z1SCs08m /dLPu/2UwAODIgAQUH5YMExuVBJ1RLg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728705447; a=rsa-sha256; cv=none; b=M1Q7LXpwsesO4bWlpcX4SverLyFvMaeVOXdv+9tA9UB3GsMMS9Rj8rHDE9Oxa1TqceW1eQ gkyLbzt3KYcWdjoHj6mbIZTGRuQrPoeozIQcWC2LgicWq/Aqa3VQbTgCcl7MekGhBgH+Mk D0IOr2avIN+HRM7u/i0gBbDXpK9vGuA= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=Xf7ebWIm; spf=pass (imf02.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1728705580; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=UYj35hoGtiu9zkkHRVDTINPh/FPLkegdGt99B9GNDmw=; b=Xf7ebWImeVB9fmqZb48oZTLP5hn4pH5p75wGMFj1/yLL8dEi9ayVyTq1UIbtGoUIOybY4XUeQFBE7LL1tGOrVRp67eU2ZizPRRN42VSPITLDseMT65Io2tTYJYfa6V/rQDJ+mzR8mBMGOXty89bpDunIRPp7hvsGRILP++x7NIE= Received: from 30.39.170.112(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WGtulhJ_1728705577 cluster:ay36) by smtp.aliyun-inc.com; Sat, 12 Oct 2024 11:59:39 +0800 Message-ID: Date: Sat, 12 Oct 2024 11:59:37 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] tmpfs: don't enable large folios if not supported To: Kefeng Wang , Andrew Morton , Hugh Dickins Cc: Alexander Viro , Christian Brauner , Jan Kara , Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand References: <20240920143654.1008756-1-wangkefeng.wang@huawei.com> <20241011065919.2086827-1-wangkefeng.wang@huawei.com> From: Baolin Wang In-Reply-To: <20241011065919.2086827-1-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 79F7D80016 X-Stat-Signature: 7hydo4kpuzusu7dpguzpcfst7zjq4gnb X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728705578-27406 X-HE-Meta: U2FsdGVkX18vtPmX3V6WX5/K3aTpAenVQstPph543ZRkVNc9aRQDz3UyqtnK+mmlNZ+499BiJqpgeyTb9AfHpVCmDpIC//vk2+D3jnervlevJjUZE/Hh3dVVdY0hhTW4zHAk4TnZEefUIppv0J7G7Mde/LvQUFIvrHLijelxtyiViryi5Z+8UtVMHSPO8CH7V46eaVzU4aMlm4L7CMAp92DDKLyZDoQoJMY0Z88CHSUbcGJjT2RQAUKrbXUpHRvayPwVt5dsjmKQmc8Xx8yqr9i7aNf/3n0EBhQUIn5gZfQoWWNNSKF4TuBVoSTNrVh7IUZPETpUEU24x+ReanuU+vKjOm5oudqot6ck8ncv4/s0OsxwiHjR3bYOneMmeBneibRGho819omTkEkWX2/IApK2mNsouOFqq9+ajrEfkuVEx51eyNp9xCdinAM5/sCYYJMfwdYre9vsSoGXBkpN321IEbqJpPbQVE+F7uMsFcmLYrdhYsMzbGuWTwW6e9T2D3Q/y9p5/nAiKqZwf21E6J/PCYwpWv6sKlqun0brQ/WupJJflvK62gmyqwkniaex/VpGRpFL9HZYq3eerlzTzfXsIX0hLUo47cXFcFNhzbF30VpjgHyxZZGsGnggHp/pa7+EGIWSaC0Anwe25STTDbriO1gTunlQXbGyf83o+TUgYOQ5CMHsnEFcRGROg3H0Tc8EpT7oiDUK72mF/1Gt6BJ8I0vgHhAnH152frCegkqNcCkvtJCwH8kKpD5sUQK4EBeoOXhb/XrAUCj4BLzFIbz86dMkA/idtfWyyRskiZnP+JQqBed9w5xMSqpzHwX6nUomHkkE+FVjg0OVUqfp8/4neB/gUZ7N3vz8Al7lAycWQe9RKjBCmfDSU386lT52xFJ2ZZkagWlPQQIwY44WIMQ6rFe8YFyfAK2IuYjLKKS2CKt+HY+J0tYqt/KoGBoKG47i/BsDMA6CnpJa77+ 6fWFg0e3 7PG3Ywny6KD2S9KnB0RVE7GiniC6m4gNou/RzR0yHPUR+l7cq+nxWHD2RIcHsTz/bVRn7PEeWhM58SBYC2ELYKz8vgxoCm9/a3ssGwXl0TdHMGcFR274PCZBkarlPKaR1NWLICGMekXDDW0uv8ashnFS4N9KYPUKw+1Ct7wcZO0w8Ysv1Vc8vtimLjioGuqJALm+ssI3Le2Um5jWDtPci+qQ+K9/qCEfzIYNjwCIYjOARx8Z6L3J2GuGQhf2BKbZjpSN8wJC42qmZSxFdFvoEkMWtaA== 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/11 14:59, Kefeng Wang wrote: > The tmpfs could support large folio, but there is some configurable > options(mount options and runtime deny/force) to enable/disable large > folio allocation, so there is a performance issue when perform write > without large folio, the issue is similar to commit 4e527d5841e2 > ("iomap: fault in smaller chunks for non-large folio mappings"). > > Don't call mapping_set_large_folios() in __shmem_get_inode() when > large folio is disabled to fix it. > > Fixes: 9aac777aaf94 ("filemap: Convert generic_perform_write() to support large folios") > Signed-off-by: Kefeng Wang > --- > > v3: > - don't enable large folio suppport in __shmem_get_inode() if disabled, > suggested by Matthew. > > v2: > - Don't use IOCB flags > > mm/shmem.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/shmem.c b/mm/shmem.c > index 0a2f78c2b919..2b859ac4ddc5 100644 > --- a/mm/shmem.c > +++ b/mm/shmem.c > @@ -2850,7 +2850,10 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap, > cache_no_acl(inode); > if (sbinfo->noswap) > mapping_set_unevictable(inode->i_mapping); > - mapping_set_large_folios(inode->i_mapping); > + > + if ((sbinfo->huge && shmem_huge != SHMEM_HUGE_DENY) || > + shmem_huge == SHMEM_HUGE_FORCE) > + mapping_set_large_folios(inode->i_mapping); IMHO, I'm still a little concerned about the 'shmem_huge' validation. Since the 'shmem_huge' can be set at runtime, that means file mapping with 'huge=always' option might miss the opportunity to allocate large folios if the 'shmem_huge' is changed from 'deny' from 'always' at runtime. So I'd like to drop the 'shmem_huge' validation and add some comments to indicate 'deny' and 'force' options are only for testing purpose and performence issue should not be a problem in the real production environments. That's just my 2 cents:)