mirror of
https://github.com/torvalds/linux.git
synced 2026-04-27 19:12:29 -04:00
Pull MM updates from Andrew Morton:
"Most of the MM queue. A few things are still pending.
Liam's maple tree rework didn't make it. This has resulted in a few
other minor patch series being held over for next time.
Multi-gen LRU still isn't merged as we were waiting for mapletree to
stabilize. The current plan is to merge MGLRU into -mm soon and to
later reintroduce mapletree, with a view to hopefully getting both
into 6.1-rc1.
Summary:
- The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe
Lin, Yang Shi, Anshuman Khandual and Mike Rapoport
- Some kmemleak fixes from Patrick Wang and Waiman Long
- DAMON updates from SeongJae Park
- memcg debug/visibility work from Roman Gushchin
- vmalloc speedup from Uladzislau Rezki
- more folio conversion work from Matthew Wilcox
- enhancements for coherent device memory mapping from Alex Sierra
- addition of shared pages tracking and CoW support for fsdax, from
Shiyang Ruan
- hugetlb optimizations from Mike Kravetz
- Mel Gorman has contributed some pagealloc changes to improve
latency and realtime behaviour.
- mprotect soft-dirty checking has been improved by Peter Xu
- Many other singleton patches all over the place"
[ XFS merge from hell as per Darrick Wong in
https://lore.kernel.org/all/YshKnxb4VwXycPO8@magnolia/ ]
* tag 'mm-stable-2022-08-03' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (282 commits)
tools/testing/selftests/vm/hmm-tests.c: fix build
mm: Kconfig: fix typo
mm: memory-failure: convert to pr_fmt()
mm: use is_zone_movable_page() helper
hugetlbfs: fix inaccurate comment in hugetlbfs_statfs()
hugetlbfs: cleanup some comments in inode.c
hugetlbfs: remove unneeded header file
hugetlbfs: remove unneeded hugetlbfs_ops forward declaration
hugetlbfs: use helper macro SZ_1{K,M}
mm: cleanup is_highmem()
mm/hmm: add a test for cross device private faults
selftests: add soft-dirty into run_vmtests.sh
selftests: soft-dirty: add test for mprotect
mm/mprotect: fix soft-dirty check in can_change_pte_writable()
mm: memcontrol: fix potential oom_lock recursion deadlock
mm/gup.c: fix formatting in check_and_migrate_movable_page()
xfs: fail dax mount if reflink is enabled on a partition
mm/memcontrol.c: remove the redundant updating of stats_flush_threshold
userfaultfd: don't fail on unrecognized features
hugetlb_cgroup: fix wrong hugetlb cgroup numa stat
...
39 lines
2.0 KiB
ReStructuredText
39 lines
2.0 KiB
ReStructuredText
:Original: Documentation/mm/page_frags.rst
|
||
|
||
:翻译:
|
||
|
||
司延腾 Yanteng Si <siyanteng@loongson.cn>
|
||
|
||
:校译:
|
||
|
||
|
||
========
|
||
页面片段
|
||
========
|
||
|
||
一个页面片段是一个任意长度的任意偏移的内存区域,它位于一个0或更高阶的复合页面中。
|
||
该页中的多个碎片在该页的引用计数器中被单独计算。
|
||
|
||
page_frag函数,page_frag_alloc和page_frag_free,为页面片段提供了一个简单
|
||
的分配框架。这被网络堆栈和网络设备驱动使用,以提供一个内存的支持区域,作为
|
||
sk_buff->head使用,或者用于skb_shared_info的 “frags” 部分。
|
||
|
||
为了使用页面片段API,需要一个支持页面片段的缓冲区。这为碎片分配提供了一个中心点,
|
||
并允许多个调用使用一个缓存的页面。这样做的好处是可以避免对get_page的多次调用,
|
||
这在分配时开销可能会很大。然而,由于这种缓存的性质,要求任何对缓存的调用都要受到每
|
||
个CPU的限制,或者每个CPU的限制,并在执行碎片分配时强制禁止中断。
|
||
|
||
网络堆栈在每个CPU使用两个独立的缓存来处理碎片分配。netdev_alloc_cache被使用
|
||
netdev_alloc_frag和__netdev_alloc_skb调用的调用者使用。napi_alloc_cache
|
||
被调用__napi_alloc_frag和__napi_alloc_skb的调用者使用。这两个调用的主要区别是
|
||
它们可能被调用的环境。“netdev” 前缀的函数可以在任何上下文中使用,因为这些函数
|
||
将禁用中断,而 ”napi“ 前缀的函数只可以在softirq上下文中使用。
|
||
|
||
许多网络设备驱动程序使用类似的方法来分配页面片段,但页面片段是在环或描述符级别上
|
||
缓存的。为了实现这些情况,有必要提供一种拆解页面缓存的通用方法。出于这个原因,
|
||
__page_frag_cache_drain被实现了。它允许通过一次调用从一个页面释放多个引用。
|
||
这样做的好处是,它允许清理被添加到一个页面的多个引用,以避免每次分配都调用
|
||
get_page。
|
||
|
||
Alexander Duyck,2016年11月29日。
|