Unverified Commit 65b1cb10 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11300 v3 mm/shmem: mTHP support for anon shmem

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/VEAX223PU7ZEIJESXNHVEEDLXLLTPPPV/ 
v2->v3: Fix compile error "unused variable".
v1->v2: No change. Resend this series after merging the series
	"mm: lazyfree THP support" since there are merge conflict.

Bang Li (5):
  mm: add update_mmu_tlb_range()
  mm: implement update_mmu_tlb() using update_mmu_tlb_range()
  mm: use update_mmu_tlb_range() to simplify code
  mm/shmem: fix input and output inconsistencies
  mm: thp: support "THPeligible" semantics for mTHP with anonymous shmem

Baolin Wang (8):
  mm: memory: extend finish_fault() to support large folio
  mm: shmem: add THP validation for PMD-mapped THP related statistics
  mm: shmem: add multi-size THP sysfs interface for anonymous shmem
  mm: shmem: add mTHP support for anonymous shmem
  mm: shmem: add mTHP size alignment in shmem_get_unmapped_area
  mm: shmem: add mTHP counters for anonymous shmem
  mm: shmem: avoid allocating huge pages larger than MAX_PAGECACHE_ORDER
    for shmem
  mm: shmem: fix incorrect aligned index when checking conflicts

Christoph Hellwig (2):
  shmem: set a_ops earlier in shmem_symlink
  shmem: move the shmem_mapping assert into shmem_get_folio_gfp

Hugh Dickins (8):
  shmem: shrink shmem_inode_info: dir_offsets in a union
  shmem: remove vma arg from shmem_get_folio_gfp()
  shmem: factor shmem_falloc_wait() out of shmem_fault()
  shmem: trivial tidyups, removing extra blank lines, etc
  shmem: shmem_acct_blocks() and shmem_inode_acct_blocks()
  shmem: move memcg charge out of shmem_add_to_page_cache()
  shmem: _add_to_page_cache() before shmem_inode_acct_blocks()
  shmem,percpu_counter: add _limited_add(fbc, limit, amount)

Lance Yang (2):
  mm: add per-order mTHP split counters
  mm: add docs for per-order mTHP split counters

Liu Shixin (1):
  mm: shmem: Merge shmem_alloc_hugefolio() with shmem_alloc_folio()

Ryan Roberts (1):
  mm: shmem: rename mTHP shmem counters


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/IAIHPC 
 
Link:https://gitee.com/openeuler/kernel/pulls/11300

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 1398fff0 210ed5ef
Loading
Loading
Loading
Loading
+63 −11
Original line number Diff line number Diff line
@@ -360,6 +360,31 @@ deny
force
    Force the huge option on for all - very useful for testing;

Shmem can also use "multi-size THP" (mTHP) by adding a new sysfs knob to
control mTHP allocation:
'/sys/kernel/mm/transparent_hugepage/hugepages-<size>kB/shmem_enabled',
and its value for each mTHP is essentially consistent with the global
setting.  An 'inherit' option is added to ensure compatibility with these
global settings.  Conversely, the options 'force' and 'deny' are dropped,
which are rather testing artifacts from the old ages.

always
    Attempt to allocate <size> huge pages every time we need a new page;

inherit
    Inherit the top-level "shmem_enabled" value. By default, PMD-sized hugepages
    have enabled="inherit" and all other hugepage sizes have enabled="never";

never
    Do not allocate <size> huge pages;

within_size
    Only allocate <size> huge page if it will be fully within i_size.
    Also respect fadvise()/madvise() hints;

advise
    Only allocate <size> huge pages if requested with fadvise()/madvise();

Need of application restart
===========================

@@ -372,10 +397,6 @@ also applies to the regions registered in khugepaged.
Monitoring usage
================

.. note::
   Currently the below counters only record events relating to
   PMD-sized THP. Events relating to other THP sizes are not included.

The number of PMD-sized anonymous transparent huge pages currently used by the
system is available by reading the AnonHugePages field in ``/proc/meminfo``.
To identify what applications are using PMD-sized anonymous transparent huge
@@ -420,20 +441,23 @@ thp_collapse_alloc_failed
	the allocation.

thp_file_alloc
	is incremented every time a file huge page is successfully
	allocated.
	is incremented every time a shmem huge page is successfully
	allocated (Note that despite being named after "file", the counter
	measures only shmem).

thp_file_fallback
	is incremented if a file huge page is attempted to be allocated
	but fails and instead falls back to using small pages.
	is incremented if a shmem huge page is attempted to be allocated
	but fails and instead falls back to using small pages. (Note that
	despite being named after "file", the counter measures only shmem).

thp_file_fallback_charge
	is incremented if a file huge page cannot be charged and instead
	is incremented if a shmem huge page cannot be charged and instead
	falls back to using small pages even though the allocation was
	successful.
	successful. (Note that despite being named after "file", the
	counter measures only shmem).

thp_file_mapped
	is incremented every time a file huge page is mapped into
	is incremented every time a file or shmem huge page is mapped into
	user address space.

thp_split_page
@@ -504,6 +528,34 @@ swpout_fallback
	Usually because failed to allocate some continuous swap space
	for the huge page.

shmem_alloc
	is incremented every time a shmem huge page is successfully
	allocated.

shmem_fallback
	is incremented if a shmem huge page is attempted to be allocated
	but fails and instead falls back to using small pages.

shmem_fallback_charge
	is incremented if a shmem huge page cannot be charged and instead
	falls back to using small pages even though the allocation was
	successful.

split
	is incremented every time a huge page is successfully split into
	smaller orders. This can happen for a variety of reasons but a
	common reason is that a huge page is old and is being reclaimed.

split_failed
	is incremented if kernel fails to split huge
	page. This can happen if the page was pinned by somebody.

split_deferred
        is incremented when a huge page is put onto split queue.
        This happens when a huge page is partially unmapped and splitting
        it would free up some memory. Pages on split queue are going to
        be split under memory pressure, if splitting is possible.

As the system ages, allocating huge pages may be expensive as the
system uses memory compaction to copy data around memory to free a
huge page for use. There are some counters in ``/proc/vmstat`` to help
+2 −2
Original line number Diff line number Diff line
@@ -470,8 +470,8 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf,
#define update_mmu_cache(vma, addr, ptep) \
	update_mmu_cache_range(NULL, vma, addr, ptep, 1)

#define __HAVE_ARCH_UPDATE_MMU_TLB
#define update_mmu_tlb	update_mmu_cache
#define update_mmu_tlb_range(vma, addr, ptep, nr) \
	update_mmu_cache_range(NULL, vma, addr, ptep, nr)

static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
			unsigned long address, pmd_t *pmdp)
+2 −2
Original line number Diff line number Diff line
@@ -594,8 +594,8 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf,
#define update_mmu_cache(vma, address, ptep) \
	update_mmu_cache_range(NULL, vma, address, ptep, 1)

#define	__HAVE_ARCH_UPDATE_MMU_TLB
#define update_mmu_tlb	update_mmu_cache
#define update_mmu_tlb_range(vma, address, ptep, nr) \
	update_mmu_cache_range(NULL, vma, address, ptep, nr)

static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
	unsigned long address, pmd_t *pmdp)
+2 −2
Original line number Diff line number Diff line
@@ -491,8 +491,8 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf,
#define update_mmu_cache(vma, addr, ptep) \
	update_mmu_cache_range(NULL, vma, addr, ptep, 1)

#define __HAVE_ARCH_UPDATE_MMU_TLB
#define update_mmu_tlb update_mmu_cache
#define update_mmu_tlb_range(vma, addr, ptep, nr) \
	update_mmu_cache_range(NULL, vma, addr, ptep, nr)

static inline void update_mmu_cache_pmd(struct vm_area_struct *vma,
		unsigned long address, pmd_t *pmdp)
+3 −3
Original line number Diff line number Diff line
@@ -410,9 +410,9 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma,

typedef pte_t *pte_addr_t;

void update_mmu_tlb(struct vm_area_struct *vma,
		    unsigned long address, pte_t *ptep);
#define __HAVE_ARCH_UPDATE_MMU_TLB
void update_mmu_tlb_range(struct vm_area_struct *vma,
		unsigned long address, pte_t *ptep, unsigned int nr);
#define update_mmu_tlb_range update_mmu_tlb_range

#endif /* !defined (__ASSEMBLY__) */

Loading