From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B49D636B074 for ; Tue, 17 Feb 2026 15:51:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771343474; cv=none; b=OTNOXMSNwM0CgTM3wHePk3YLg4Nh0F5N6OWndnUkr8Igyvkh8JqUl2/LGG/A3VqXMNIN/Zv5u/rJkKZLcl9WakBWVvGiGH+sKf6gIe8n+Ucu0vGNRp2t6MeFUBYPItE2ocYPyAvQWdlBDl19wYAEYUgCcgVtNEekCMvhO573LJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771343474; c=relaxed/simple; bh=je5UTgxbJfOBRA44vjRHFqX8YGyeLBNHdH9yI6Y8GKc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OBO5fkETTJjE4abs/1YUS3VsG00pMwIuf1irMw4t1Kr3gBCfYE6nXvFwF4JQ/o8eykVSRHNgsr3KkzvotSFEfxf7ZfrmgxHmuIG+zOP2G+lemPNVMwdHOTJ0D8Rrm+vpJmhiUizm6eTq5kcoi+Hr1oukJd3DfSzwALkwxJ3vtpg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 712C61477; Tue, 17 Feb 2026 07:51:04 -0800 (PST) Received: from [10.1.30.186] (XHFQ2J9959.cambridge.arm.com [10.1.30.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ACF763F632; Tue, 17 Feb 2026 07:51:07 -0800 (PST) Message-ID: <0a772015-f9ea-4c7b-a42f-393a2f591f98@arm.com> Date: Tue, 17 Feb 2026 15:51:05 +0000 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: [LSF/MM/BPF TOPIC] Per-process page size Content-Language: en-GB To: "David Hildenbrand (Arm)" , Matthew Wilcox , Dev Jain Cc: lsf-pc@lists.linux-foundation.org, catalin.marinas@arm.com, will@kernel.org, ardb@kernel.org, hughd@google.com, baolin.wang@linux.alibaba.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, mhocko@suse.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260217145026.3880286-1-dev.jain@arm.com> <2e68ef61-dcf2-46b2-913f-14980a104faf@kernel.org> From: Ryan Roberts In-Reply-To: <2e68ef61-dcf2-46b2-913f-14980a104faf@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 17/02/2026 15:30, David Hildenbrand (Arm) wrote: > On 2/17/26 16:22, Matthew Wilcox wrote: >> On Tue, Feb 17, 2026 at 08:20:26PM +0530, Dev Jain wrote: >>> 2. Generic Linux MM enlightenment >>> --------------------------------- >>> We enlighten the Linux MM code to always hand out memory in the granularity >> >> Please don't use the term "enlighten".  Tht's used to describe something >> something or other with hypervisors.  Come up with a new term or use one >> that already exists. >> >>> File memory >>> ----------- >>> For a growing list of compliant file systems, large folios can already be >>> stored in the page cache. There is even a mechanism, introduced to support >>> filesystems with block sizes larger than the system page size, to set a >>> hard-minimum size for folios on a per-address-space basis. This mechanism >>> will be reused and extended to service the per-process page size requirements. >>> >>> One key reason that the 64K kernel currently consumes considerably more memory >>> than the 4K kernel is that Linux systems often have lots of small >>> configuration files which each require a page in the page cache. But these >>> small files are (likely) only used by certain processes. So, we prefer to >>> continue to cache those using a 4K page. >>> Therefore, if a process with a larger page size maps a file whose pagecache >>> contains smaller folios, we drop them and re-read the range with a folio >>> order at least that of the process order. >> >> That's going to be messy.  I don't have a good idea for solving this >> problem, but the page cache really isn't set up to change minimum folio >> order while the inode is in use. Dev has a prototype up and running, but based on your comments, I'm guessing there is some horrible race that hasn't hit yet. Would be good to debug the gap in understanding at some point! > > In a private conversation I also raised that some situations might make it > impossible/hard to drop+re-read. > > One example I cam up with if a folio is simply long-term R/O pinned. But I am > also not quite sure how mlock might interfere here. > > So yes, I think the page cache is likely the one of the most problematic/messy > thing to handle. > I guess we could side step the problem for now, by initially requiring that the minimum folio size always be the maximum supported process page size. That would allow us to get something up and running at least. But then we lose the memory saving benefits. Of course, I'm conveniently ignoring that not all filesystems support large folios, but perhaps we could do a generic fallback adapter with a bounce buffer for that case?