From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-97.freemail.mail.aliyun.com (out30-97.freemail.mail.aliyun.com [115.124.30.97]) (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 DD6DC1E531 for ; Thu, 16 Apr 2026 01:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776301376; cv=none; b=lPi2n8F9+hE6YTyYy8joncSaQ1ikGu0JTiW9Cy69IyeiZB4reR6/Se7Q7LcA7/QHPjl6FMRPkdyB6BmO1F5746t++saRfkvHiCBldTJkxhOb7NOry0xatutCP9J80VL/60YM5Z091dMiDn1dwbiveoQ7NZQcat4IohRxCeQL0lw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776301376; c=relaxed/simple; bh=CDwN454KwdWpHCkunopLY7wslMcnkUx5H2ebAuOxPnM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=uxvE8V/UGfcygpA1BSj0YUle0rGhFiKT4/y9rzIjBrLyUIlSBpqTPS1p1F7h3W3uSBSlHP67ZlQsNNwgzcDTi256XJoBFD9Nc80lI6ednKtuuiF39Vr1WZZ6XzIPx1LE1xg3KqHtJzspMItLMuDO2Bppb0r6nkwm4Qf7YXuVJoc= 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=Uig85Owz; arc=none smtp.client-ip=115.124.30.97 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="Uig85Owz" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1776301371; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=8tvR6j+WnM9Rqg1W+aSR1Bip5pdx0V3AQgd1HBaA/BM=; b=Uig85Owz2qrPGTPbhph4jy/e29B9PvJSgqZtbz9ZPhI/35eZ/TmF/mJGIGSvk/og6fRi/WKoeHfhx/uqBnu3hR0XLLDc4yNrdhCHmAG4Z1cWK27CiYUbJjOOamqbta7sFBVbsTDkvuGfh7Wfdyw1TEjNEde9dO8Nmr2z63HIt1U= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0X162oXY_1776301370; Received: from 30.74.144.131(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X162oXY_1776301370 cluster:ay36) by smtp.aliyun-inc.com; Thu, 16 Apr 2026 09:02:51 +0800 Message-ID: <760c048b-8da3-435b-a28f-fa8ec519cdc6@linux.alibaba.com> Date: Thu, 16 Apr 2026 09:02:50 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] mm: shmem: don't set large-order range for internal shmem mount To: Matthew Wilcox Cc: akpm@linux-foundation.org, hughd@google.com, ziy@nvidia.com, david@kernel.org, ljs@kernel.org, lance.yang@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 4/15/26 9:45 PM, Matthew Wilcox wrote: > On Wed, Apr 15, 2026 at 04:22:53PM +0800, Baolin Wang wrote: >> + /* >> + * Only set the large order range for tmpfs mounts. The large order >> + * selection for the internal shmem mount is configured dynamically >> + * via the 'shmem_enabled' interfaces, so there is no need to set a >> + * large order range for the internal shmem mount's mapping. >> + * >> + * Note: Don't consider 'deny' for emergencies and 'force' for >> + * testing. >> + */ >> + if (sbinfo->huge && !(sb->s_flags & SB_KERNMOUNT)) >> mapping_set_large_folios(inode->i_mapping); > > This isn't how mapping_set_large_folios() is supposed to be used. > It's supposed to indicate "does the filesystem support large folios". > shmem should be setting it unconditionally and if there needs to be some > other way to prevent large folios from being created, we should do that > instead. As discussed with David, we’ve agreed that for anonymous shmem we should set mapping_set_large_folios() unconditionally. However, for tmpfs mounts, we should still respect the 'huge=' mount option. This was a previous performance fix, see commit 5a90c155defa ("tmpfs: don't enable large folios if not supported").