From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (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 D59061E98EF for ; Thu, 23 Apr 2026 02:58:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776913105; cv=none; b=LSv/b5Q10/gu+VL50SzJd+G7a+2L+PQ676QCHgrg5j34ccDLY870ZT2/axlRA5EgcqP0PM9MNj77Z9HmBxpnUKl60yHKUc1ujUXQ1MS3VO9kp1H7ltG5LdHDG3qQiNnDHNfN+qbnQqQp5ZeIMVooxPHC/FnqGKmF5fRWc33Ejbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776913105; c=relaxed/simple; bh=4t1KTkHst3DgzF7ovXnj4u2GEhX05NNYyESzxY3DxV8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Oy6wcRQWfrWQ5sOjId/2MW9ACC2P5G8x0ikzyPw1/0hwqAvWGAw2lsAZrdvyl003eU6PpQpMZxwhvHpB99KvvJQLkfBdHtVC2M+njIKCsPArRVVDAgx09WnZZnac7Eqq3XWWb3SPykcQXyzCqr2/q2jSr7e5XgXTAqo5YmUiYgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=UO5duJjZ; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="UO5duJjZ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776913101; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4t1KTkHst3DgzF7ovXnj4u2GEhX05NNYyESzxY3DxV8=; b=UO5duJjZ6yiGRNA3D/aSiBQ+FMx26q7Jd+G3mgJww/pIYxzpHjow/2cXV5oVtY8XjuEyHq S6zPEeFG8Bi59JWil0eQxniu4OcF+/gXAwY6TUUI/GkxLwP1Ajteu7pI9YxvsYKQZ9febS rvWCexq8PM7izD9DLdCDmDxFyi24vek= From: Lance Yang To: baolin.wang@linux.alibaba.com Cc: akpm@linux-foundation.org, hughd@google.com, willy@infradead.org, ziy@nvidia.com, david@kernel.org, ljs@kernel.org, lance.yang@linux.dev, wangkefeng.wang@huawei.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Revert "tmpfs: don't enable large folios if not supported" Date: Thu, 23 Apr 2026 10:57:37 +0800 Message-Id: <20260423025737.60982-1-lance.yang@linux.dev> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On Thu, Apr 23, 2026 at 09:41:42AM +0800, Baolin Wang wrote: >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 anonymous >shmem, whether it supports large folios can be dynamically configured via sysfs >interfaces, so setting or not setting mapping_set_large_folios() during initialization >cannot accurately reflect whether anonymous shmem actually supports large folios, >which has already caused some confusion[1]. > >Moreover, for tmpfs mounts, relying on 'sbinfo->huge' cannot keep the mapping_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 mappings >supporting large folios (calling mapping_set_large_folios()) while others don't. > >After some investigation, I found that the write performance regression addressed >by commit 5a90c155defa has already been fixed by the following commit 665575cff098b >("filemap: move prefaulting out of hot write path"). See the following test data: > >Base: >dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.2 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.2 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.1 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.0 GB/s ) >dd if=/dev/zero of=/mnt/tmpfs/test bs=3000K count=1398 (3.0 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (3.1 GB/s) > >Base + revert 5a90c155defa: >dd if=/dev/zero of=/mnt/tmpfs/test bs=400K count=10485 (3.3 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=800K count=5242 (3.3 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=1600K count=2621 (3.2 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=2200K count=1906 (3.1 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/testbs=3000K count=1398 (3.0 GB/s) >dd if=/dev/zero of=/mnt/tmpfs/test bs=4500K count=932 (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 >--- >Note: for more investigation and test data, see: >https://lore.kernel.org/all/116df9f9-4db7-40d4-a4a4-30a87c0feffa@linux.alibaba.com/ >Thanks Kefeng for confirming the performance issue. >--- Thanks for tackling this! Reviewed-by: Lance Yang