From nobody Wed Jun 17 05:11:04 2026 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B92A3B3BF3 for ; Thu, 23 Apr 2026 01:42:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.112 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776908533; cv=none; b=LOUXyG0aFkvJArimU2lBZy4f4UrIjYvVvLnUk8oMM4+A7oZp1pJX8WTQ0GIkRaSuJEuWJG5+pqxUsUP7XSIRKTpRjYPuHq/eLdgVTK2B/K01LQ0HhMAexmaFTpLGQKgHg8N2xAQ2Q3vFOV4m/lPpyIPwg0l3fPcVdWFrUnTi+Wg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776908533; c=relaxed/simple; bh=iOxsJH6cAvRLUbWtLyXOMiCcVHWj/FKfXosUO7l9/os=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mnOP8oaljqXcvF9qFDFPKOJv0aeutHvq49kpv6aibpibp9yME4z5QvXB2W0St8sNamE1zYVzU1bURNUBVudBl6Lqr88ug8B4HZJ32ohZkhWpztbBoc6RbsDobyzj/1WyfDM431qvK9a687f6VC4n3yI3TT3wxwMrmDK8iFUgFfA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=x3u89gX7; arc=none smtp.client-ip=115.124.30.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="x3u89gX7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1776908510; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=eS2Rq2WCDekRzqG5jZeEs1T3Qy5ZrrxcUaInoP4NY9c=; b=x3u89gX7ViMAiyllB4Tmg0A9OUDhmt+YsXCnAl/05D9bOJnBJgajNQzfLIgYacczP8laqXTP9OfsGPO0laZla5gJ09g8GT4p27ZfW/h8iM99jE/t282FAT4b5nOgb04AuPx+ZpqB95fNDs/8DKslkj27W2zm2mvO516jGFlb3sI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0X1Y3E5F_1776908509; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X1Y3E5F_1776908509 cluster:ay36) by smtp.aliyun-inc.com; Thu, 23 Apr 2026 09:41:49 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, ziy@nvidia.com, david@kernel.org, ljs@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] Revert "tmpfs: don't enable large folios if not supported" Date: Thu, 23 Apr 2026 09:41:42 +0800 Message-ID: X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This reverts commit 5a90c155defa684f3a21f68c3f8e40c056e6114c. Currently, when shmem mounts are initialized, they only use 'sbinfo->huge' = to determine whether the shmem mount supports large folios. However, for anony= mous shmem, whether it supports large folios can be dynamically configured via s= ysfs interfaces, so setting or not setting mapping_set_large_folios() during ini= tialization cannot accurately reflect whether anonymous shmem actually supports large f= olios, which has already caused some confusion[1]. Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mappi= ng_set_large_folios() setting consistent across all mappings in the entire tmpfs mount. In other = words, under the same tmpfs mount, after remount, we might end up with some mappin= gs supporting large folios (calling mapping_set_large_folios()) while others d= on't. After some investigation, I found that the write performance regression add= ressed by commit 5a90c155defa has already been fixed by the following commit 66557= 5cff098b ("filemap: move prefaulting out of hot write path"). See the following test= data: Base: dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D400K count=3D10485 (3.2 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D800K count=3D5242 (3.2 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D1600K count=3D2621 (3.1 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D2200K count=3D1906 (3.0 GB/s ) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D3000K count=3D1398 (3.0 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D4500K count=3D932 (3.1 GB/s) Base + revert 5a90c155defa: dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D400K count=3D10485 (3.3 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D800K count=3D5242 (3.3 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D1600K count=3D2621 (3.2 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D2200K count=3D1906 (3.1 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/testbs=3D3000K count=3D1398 (3.0 GB/s) dd if=3D/dev/zero of=3D/mnt/tmpfs/test bs=3D4500K count=3D932 (3.1 GB/s) The data is basically consistent with minor fluctuation noise. So we can now safely revert commit 5a90c155defa to set mapping_set_large_folios() for all shmem mounts unconditionally. [1] https://lore.kernel.org/all/ec927492-4577-4192-8fad-85eb1bb43121@linux.= alibaba.com/ Signed-off-by: Baolin Wang Acked-by: David Hildenbrand (Arm) Acked-by: Lorenzo Stoakes Acked-by: Zi Yan Reviewed-by: Lance Yang --- Note: for more investigation and test data, see: https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alib= aba.com/ Thanks Kefeng for confirming the performance issue. --- mm/shmem.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4ecefe02881d..dafbea53b22d 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3087,10 +3087,7 @@ static struct inode *__shmem_get_inode(struct mnt_id= map *idmap, cache_no_acl(inode); if (sbinfo->noswap) mapping_set_unevictable(inode->i_mapping); - - /* Don't consider 'deny' for emergencies and 'force' for testing */ - if (sbinfo->huge) - mapping_set_large_folios(inode->i_mapping); + mapping_set_large_folios(inode->i_mapping); =20 switch (mode & S_IFMT) { default: --=20 2.47.3