hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IAO6NS
--------------------------------
The large folios is not supported in dynamic pool, so we have to limit order to 0 when it will be allocated from dynamic pool. The allocation in shmem has already been limited in commit d0ef72eca876 ("mm: shmem: add mTHP support for anonymous shmem"), and now we are limit the allocation in anon/file path.
Fixes: ba572beac8be ("mm: thp: support allocation of anonymous multi-size THP") Signed-off-by: Liu Shixin liushixin2@huawei.com --- mm/filemap.c | 3 +++ mm/memory.c | 2 ++ mm/readahead.c | 3 +++ 3 files changed, 8 insertions(+)
diff --git a/mm/filemap.c b/mm/filemap.c index eb96ddf00ba8d..630a3eec5a881 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -47,6 +47,7 @@ #include <linux/splice.h> #include <linux/huge_mm.h> #include <linux/pgtable.h> +#include <linux/dynamic_pool.h> #include <asm/pgalloc.h> #include <asm/tlbflush.h> #include "internal.h" @@ -1931,6 +1932,8 @@ struct folio *__filemap_get_folio(struct address_space *mapping, pgoff_t index,
if (!mapping_large_folio_support(mapping)) order = 0; + if (order && mm_in_dynamic_pool(current->mm)) + order = 0; if (order > MAX_PAGECACHE_ORDER) order = MAX_PAGECACHE_ORDER; /* If we're not aligned, allocate a smaller folio */ diff --git a/mm/memory.c b/mm/memory.c index 2771c10454e17..84ff5ac8fb968 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4395,6 +4395,8 @@ static struct folio *alloc_anon_folio(struct vm_fault *vmf) */ if (unlikely(userfaultfd_armed(vma))) goto fallback; + if (mm_in_dynamic_pool(vma->vm_mm)) + goto fallback;
/* * Get a list of all the (large) orders below PMD_ORDER that are enabled diff --git a/mm/readahead.c b/mm/readahead.c index a8911f7c161a7..d0b3de43cf23b 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -128,6 +128,7 @@ #include <linux/blk-cgroup.h> #include <linux/fadvise.h> #include <linux/sched/mm.h> +#include <linux/dynamic_pool.h>
#include "internal.h"
@@ -503,6 +504,8 @@ void page_cache_ra_order(struct readahead_control *ractl,
if (!mapping_large_folio_support(mapping) || ra->size < 4) goto fallback; + if (mm_in_dynamic_pool(current->mm)) + goto fallback;
limit = min(limit, index + ra->size - 1);