remove references to page->flags in documentation

Mostly rewording, but remove entirely the copy of page_fixed_fake_head()
in the documentation; we can refer people to the actual source if
necessary.

Link: https://lkml.kernel.org/r/20240326171045.410737-10-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-03-26 17:10:31 +00:00 committed by Andrew Morton
parent 5e0debe012
commit 4dc7d37370
5 changed files with 7 additions and 27 deletions

View File

@ -300,14 +300,14 @@ When oom event notifier is registered, event will be delivered.
Lock order is as follows:: Lock order is as follows::
Page lock (PG_locked bit of page->flags) folio_lock
mm->page_table_lock or split pte_lock mm->page_table_lock or split pte_lock
folio_memcg_lock (memcg->move_lock) folio_memcg_lock (memcg->move_lock)
mapping->i_pages lock mapping->i_pages lock
lruvec->lru_lock. lruvec->lru_lock.
Per-node-per-memcgroup LRU (cgroup's private LRU) is guarded by Per-node-per-memcgroup LRU (cgroup's private LRU) is guarded by
lruvec->lru_lock; PG_lru bit of page->flags is cleared before lruvec->lru_lock; the folio LRU flag is cleared before
isolating a page from its LRU under lruvec->lru_lock. isolating a page from its LRU under lruvec->lru_lock.
.. _cgroup-v1-memory-kernel-extension: .. _cgroup-v1-memory-kernel-extension:

View File

@ -180,27 +180,7 @@ this correctly. There is only **one** head ``struct page``, the tail
``struct page`` with ``PG_head`` are fake head ``struct page``. We need an ``struct page`` with ``PG_head`` are fake head ``struct page``. We need an
approach to distinguish between those two different types of ``struct page`` so approach to distinguish between those two different types of ``struct page`` so
that ``compound_head()`` can return the real head ``struct page`` when the that ``compound_head()`` can return the real head ``struct page`` when the
parameter is the tail ``struct page`` but with ``PG_head``. The following code parameter is the tail ``struct page`` but with ``PG_head``.
snippet describes how to distinguish between real and fake head ``struct page``.
.. code-block:: c
if (test_bit(PG_head, &page->flags)) {
unsigned long head = READ_ONCE(page[1].compound_head);
if (head & 1) {
if (head == (unsigned long)page + 1)
/* head struct page */
else
/* tail struct page */
} else {
/* head struct page */
}
}
We can safely access the field of the **page[1]** with ``PG_head`` because the
page is a compound page composed with at least two contiguous pages.
The implementation refers to ``page_fixed_fake_head()``.
Device DAX Device DAX
========== ==========

View File

@ -260,7 +260,7 @@ HyperSparc cpu就是这样一个具有这种属性的cpu。
如果D-cache别名不是一个问题这个程序可以简单地定义为该架构上 如果D-cache别名不是一个问题这个程序可以简单地定义为该架构上
的nop。 的nop。
page->flags (PG_arch_1)中有一个位是“架构私有”。内核保证, folio->flags (PG_arch_1)中有一个位是“架构私有”。内核保证,
对于分页缓存的页面,当这样的页面第一次进入分页缓存时,它将清除 对于分页缓存的页面,当这样的页面第一次进入分页缓存时,它将清除
这个位。 这个位。

View File

@ -113,7 +113,7 @@ bool isolate_movable_page(struct page *page, isolate_mode_t mode)
if (!mops->isolate_page(&folio->page, mode)) if (!mops->isolate_page(&folio->page, mode))
goto out_no_isolated; goto out_no_isolated;
/* Driver shouldn't use PG_isolated bit of page->flags */ /* Driver shouldn't use the isolated flag */
WARN_ON_ONCE(folio_test_isolated(folio)); WARN_ON_ONCE(folio_test_isolated(folio));
folio_set_isolated(folio); folio_set_isolated(folio);
folio_unlock(folio); folio_unlock(folio);

View File

@ -23,7 +23,7 @@
* inode->i_rwsem (while writing or truncating, not reading or faulting) * inode->i_rwsem (while writing or truncating, not reading or faulting)
* mm->mmap_lock * mm->mmap_lock
* mapping->invalidate_lock (in filemap_fault) * mapping->invalidate_lock (in filemap_fault)
* page->flags PG_locked (lock_page) * folio_lock
* hugetlbfs_i_mmap_rwsem_key (in huge_pmd_share, see hugetlbfs below) * hugetlbfs_i_mmap_rwsem_key (in huge_pmd_share, see hugetlbfs below)
* vma_start_write * vma_start_write
* mapping->i_mmap_rwsem * mapping->i_mmap_rwsem
@ -50,7 +50,7 @@
* hugetlb_fault_mutex (hugetlbfs specific page fault mutex) * hugetlb_fault_mutex (hugetlbfs specific page fault mutex)
* vma_lock (hugetlb specific lock for pmd_sharing) * vma_lock (hugetlb specific lock for pmd_sharing)
* mapping->i_mmap_rwsem (also used for hugetlb pmd sharing) * mapping->i_mmap_rwsem (also used for hugetlb pmd sharing)
* page->flags PG_locked (lock_page) * folio_lock
*/ */
#include <linux/mm.h> #include <linux/mm.h>