mm-factor-out-the-order-calculation-into-a-new-helper.patch removed from -mm tree
The quilt patch titled
Subject: mm: factor out the order calculation into a new helper
has been removed from the -mm tree. Its filename was
mm-factor-out-the-order-calculation-into-a-new-helper.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Baolin Wang <[email protected]>
Subject: mm: factor out the order calculation into a new helper
Date: Thu, 28 Nov 2024 15:40:39 +0800
Patch series "Support large folios for tmpfs", v3.
Traditionally, tmpfs only supported PMD-sized large folios. However nowadays with other file systems supporting any sized large folios, and extending anonymous to support mTHP, we should not restrict tmpfs to allocating only PMD-sized large folios, making it more special. Instead, we should allow tmpfs can allocate any sized large folios.
Considering that tmpfs already has the 'huge=' option to control the PMD-sized large folios allocation, we can extend the 'huge=' option to allow any sized large folios. The semantics of the 'huge=' mount option are:
huge=never: no any sized large folios huge=always: any sized large folios huge=within_size: like 'always' but respect the i_size huge=advise: like 'always' if requested with madvise()
Note: for tmpfs mmap() faults, due to the lack of a write size hint, still allocate the PMD-sized large folios if huge=always/within_size/advise is set.
Moreover, the 'deny' and 'force' testing options controlled by '/sys/kernel/mm/transparent_hugepage/shmem_enabled', still retain the same semantics. The 'deny' can disable any sized large folios for tmpfs, while the 'force' can enable PMD sized large folios for tmpfs.
This patch (of 6):
Factor out the order calculation into a new helper, which can be reused by shmem in the following patch.
---
include/linux/pagemap.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
include/linux/pagemap.h renamed from include/linux/pagemap.h~mm-factor-out-the-order-calculation-into-a-new-helper +13 -3
@@ -727,6 +727,16 @@ typedef unsigned int __bitwise fgf_t;#define FGP_WRITEBEGIN (FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE) +static inline unsigned int filemap_get_order (size_t size) +{ +unsigned int shift =ilog2 (size); + +if (shift <=PAGE_SHIFT ) +return 0 ; + +return shift -PAGE_SHIFT ; +} +/** * fgf_set_order - Encode a length in the fgf_t flags. * @size: The suggested size of the folio to create.
@@ -740,11 +750,11 @@ typedef unsigned int __bitwise fgf_t;*/ static inline fgf_t fgf_set_order (size_t size) { -unsigned int shift =ilog2 (size); +unsigned int order =filemap_get_order (size); -if (shift <=PAGE_SHIFT ) +if (!order)return 0 ; -return (__force fgf_t)((shift -PAGE_SHIFT ) <<26 ); +return (__force fgf_t)(order <<26 ); }void *filemap_get_entry (struct address_space *mapping,pgoff_t index);
_
Patches currently in -mm which might be from [email protected] are