Qsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget%/translations/zh_CN/mm/page_migrationmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/zh_TW/mm/page_migrationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/it_IT/mm/page_migrationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ja_JP/mm/page_migrationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/ko_KR/mm/page_migrationmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget%/translations/sp_SP/mm/page_migrationmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hPage migrationh]hPage migration}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh?/var/lib/git/docbuild/linux/Documentation/mm/page_migration.rsthKubh paragraph)}(hXPage migration allows moving the physical location of pages between nodes in a NUMA system while the process is running. This means that the virtual addresses that the process sees do not change. However, the system rearranges the physical location of those pages.h]hXPage migration allows moving the physical location of pages between nodes in a NUMA system while the process is running. This means that the virtual addresses that the process sees do not change. However, the system rearranges the physical location of those pages.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hWAlso see Documentation/mm/hmm.rst for migrating pages to or from device private memory.h]hWAlso see Documentation/mm/hmm.rst for migrating pages to or from device private memory.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hThe main intent of page migration is to reduce the latency of memory accesses by moving pages near to the processor where the process accessing that memory is running.h]hThe main intent of page migration is to reduce the latency of memory accesses by moving pages near to the processor where the process accessing that memory is running.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hXpPage migration allows a process to manually relocate the node on which its pages are located through the MF_MOVE and MF_MOVE_ALL options while setting a new memory policy via mbind(). The pages of a process can also be relocated from another process using the sys_migrate_pages() function call. The migrate_pages() function call takes two sets of nodes and moves pages of a process that are located on the from nodes to the destination nodes. Page migration functions are provided by the numactl package by Andi Kleen (a version later than 0.9.3 is required. Get it from https://github.com/numactl/numactl.git). numactl provides libnuma which provides an interface similar to other NUMA functionality for page migration. cat ``/proc//numa_maps`` allows an easy review of where the pages of a process are located. See also the numa_maps documentation in the proc(5) man page.h](hX;Page migration allows a process to manually relocate the node on which its pages are located through the MF_MOVE and MF_MOVE_ALL options while setting a new memory policy via mbind(). The pages of a process can also be relocated from another process using the sys_migrate_pages() function call. The migrate_pages() function call takes two sets of nodes and moves pages of a process that are located on the from nodes to the destination nodes. Page migration functions are provided by the numactl package by Andi Kleen (a version later than 0.9.3 is required. Get it from }(hhhhhNhNubh reference)}(h&https://github.com/numactl/numactl.gith]h&https://github.com/numactl/numactl.git}(hhhhhNhNubah}(h]h ]h"]h$]h&]refurihuh1hhhubhu). numactl provides libnuma which provides an interface similar to other NUMA functionality for page migration. cat }(hhhhhNhNubhliteral)}(h``/proc//numa_maps``h]h/proc//numa_maps}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhhubh allows an easy review of where the pages of a process are located. See also the numa_maps documentation in the proc(5) man page.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX{Manual migration is useful if for example the scheduler has relocated a process to a processor on a distant node. A batch scheduler or an administrator may detect the situation and move the pages of the process nearer to the new processor. The kernel itself only provides manual page migration support. Automatic page migration may be implemented through user space processes that move pages. A special function call "move_pages" allows the moving of individual pages within a process. For example, A NUMA profiler may obtain a log showing frequent off-node accesses and may use the result to move pages to more advantageous locations.h]hXManual migration is useful if for example the scheduler has relocated a process to a processor on a distant node. A batch scheduler or an administrator may detect the situation and move the pages of the process nearer to the new processor. The kernel itself only provides manual page migration support. Automatic page migration may be implemented through user space processes that move pages. A special function call “move_pages” allows the moving of individual pages within a process. For example, A NUMA profiler may obtain a log showing frequent off-node accesses and may use the result to move pages to more advantageous locations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXLarger installations usually partition the system using cpusets into sections of nodes. Paul Jackson has equipped cpusets with the ability to move pages when a task is moved to another cpuset (See :ref:`CPUSETS `). Cpusets allow the automation of process locality. If a task is moved to a new cpuset then also all its pages are moved with it so that the performance of the process does not sink dramatically. Also the pages of processes in a cpuset are moved if the allowed memory nodes of a cpuset are changed.h](hLarger installations usually partition the system using cpusets into sections of nodes. Paul Jackson has equipped cpusets with the ability to move pages when a task is moved to another cpuset (See }(hj(hhhNhNubh)}(h:ref:`CPUSETS `h]hinline)}(hj2h]hCPUSETS}(hj6hhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1j4hj0ubah}(h]h ]h"]h$]h&]refdocmm/page_migration refdomainjAreftyperef refexplicitrefwarn reftargetcpusetsuh1hhhhK*hj(ubhX+). Cpusets allow the automation of process locality. If a task is moved to a new cpuset then also all its pages are moved with it so that the performance of the process does not sink dramatically. Also the pages of processes in a cpuset are moved if the allowed memory nodes of a cpuset are changed.}(hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK*hhhhubh)}(hX\Page migration allows the preservation of the relative location of pages within a group of nodes for all migration techniques which will preserve a particular memory allocation pattern generated even after migrating a process. This is necessary in order to preserve the memory latencies. Processes will run with similar performance after migration.h]hX\Page migration allows the preservation of the relative location of pages within a group of nodes for all migration techniques which will preserve a particular memory allocation pattern generated even after migrating a process. This is necessary in order to preserve the memory latencies. Processes will run with similar performance after migration.}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubh)}(hX Page migration occurs in several steps. First a high level description for those trying to use migrate_pages() from the kernel (for userspace usage see the Andi Kleen's numactl package mentioned above) and then a low level description of how the low level details work.h]hXPage migration occurs in several steps. First a high level description for those trying to use migrate_pages() from the kernel (for userspace usage see the Andi Kleen’s numactl package mentioned above) and then a low level description of how the low level details work.}(hjmhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hhhhubh)}(hhh](h)}(h In kernel use of migrate_pages()h]h In kernel use of migrate_pages()}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhK@ubhenumerated_list)}(hhh](h list_item)}(hXqRemove folios from the LRU. Lists of folios to be migrated are generated by scanning over folios and moving them into lists. This is done by calling folio_isolate_lru(). Calling folio_isolate_lru() increases the references to the folio so that it cannot vanish while the folio migration occurs. It also prevents the swapper or other scans from encountering the folio. h](h)}(hRemove folios from the LRU.h]hRemove folios from the LRU.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjubh)}(hXSLists of folios to be migrated are generated by scanning over folios and moving them into lists. This is done by calling folio_isolate_lru(). Calling folio_isolate_lru() increases the references to the folio so that it cannot vanish while the folio migration occurs. It also prevents the swapper or other scans from encountering the folio.h]hXSLists of folios to be migrated are generated by scanning over folios and moving them into lists. This is done by calling folio_isolate_lru(). Calling folio_isolate_lru() increases the references to the folio so that it cannot vanish while the folio migration occurs. It also prevents the swapper or other scans from encountering the folio.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hWe need to have a function of type new_folio_t that can be passed to migrate_pages(). This function should figure out how to allocate the correct new folio given the old folio. h]h)}(hWe need to have a function of type new_folio_t that can be passed to migrate_pages(). This function should figure out how to allocate the correct new folio given the old folio.h]hWe need to have a function of type new_folio_t that can be passed to migrate_pages(). This function should figure out how to allocate the correct new folio given the old folio.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hThe migrate_pages() function is called which attempts to do the migration. It will call the function to allocate the new folio for each folio that is considered for moving. h]h)}(hThe migrate_pages() function is called which attempts to do the migration. It will call the function to allocate the new folio for each folio that is considered for moving.h]hThe migrate_pages() function is called which attempts to do the migration. It will call the function to allocate the new folio for each folio that is considered for moving.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jhj{hhhhhKBubeh}(h]in-kernel-use-of-migrate-pagesah ]h"] in kernel use of migrate_pages()ah$]h&]uh1hhhhhhhhK@ubh)}(hhh](h)}(hHow migrate_pages() worksh]hHow migrate_pages() works}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKUubh)}(hX+migrate_pages() does several passes over its list of folios. A folio is moved if all references to a folio are removable at the time. The folio has already been removed from the LRU via folio_isolate_lru() and the refcount is increased so that the folio cannot be freed while folio migration occurs.h]hX+migrate_pages() does several passes over its list of folios. A folio is moved if all references to a folio are removable at the time. The folio has already been removed from the LRU via folio_isolate_lru() and the refcount is increased so that the folio cannot be freed while folio migration occurs.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKWhjhhubh)}(hSteps:h]hSteps:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK\hjhhubj)}(hhh](j)}(hLock the page to be migrated. h]h)}(hLock the page to be migrated.h]hLock the page to be migrated.}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK^hj,ubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h#Ensure that writeback is complete. h]h)}(h"Ensure that writeback is complete.h]h"Ensure that writeback is complete.}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hjDubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hLock the new page that we want to move to. It is locked so that accesses to this (not yet up-to-date) page immediately block while the move is in progress. h]h)}(hLock the new page that we want to move to. It is locked so that accesses to this (not yet up-to-date) page immediately block while the move is in progress.h]hLock the new page that we want to move to. It is locked so that accesses to this (not yet up-to-date) page immediately block while the move is in progress.}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKbhj\ubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hXNAll the page table references to the page are converted to migration entries. This decreases the mapcount of a page. If the resulting mapcount is not zero then we do not migrate the page. All user space processes that attempt to access the page will now wait on the page lock or wait for the migration page table entry to be removed. h]h)}(hXMAll the page table references to the page are converted to migration entries. This decreases the mapcount of a page. If the resulting mapcount is not zero then we do not migrate the page. All user space processes that attempt to access the page will now wait on the page lock or wait for the migration page table entry to be removed.h]hXMAll the page table references to the page are converted to migration entries. This decreases the mapcount of a page. If the resulting mapcount is not zero then we do not migrate the page. All user space processes that attempt to access the page will now wait on the page lock or wait for the migration page table entry to be removed.}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjtubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h}The i_pages lock is taken. This will cause all processes trying to access the page via the mapping to block on the spinlock. h]h)}(h|The i_pages lock is taken. This will cause all processes trying to access the page via the mapping to block on the spinlock.h]h|The i_pages lock is taken. This will cause all processes trying to access the page via the mapping to block on the spinlock.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKkhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe refcount of the page is examined and we back out if references remain. Otherwise, we know that we are the only one referencing this page. h]h)}(hThe refcount of the page is examined and we back out if references remain. Otherwise, we know that we are the only one referencing this page.h]hThe refcount of the page is examined and we back out if references remain. Otherwise, we know that we are the only one referencing this page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe radix tree is checked and if it does not contain the pointer to this page then we back out because someone else modified the radix tree. h]h)}(hThe radix tree is checked and if it does not contain the pointer to this page then we back out because someone else modified the radix tree.h]hThe radix tree is checked and if it does not contain the pointer to this page then we back out because someone else modified the radix tree.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKqhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe new page is prepped with some settings from the old page so that accesses to the new page will discover a page with the correct settings. h]h)}(hThe new page is prepped with some settings from the old page so that accesses to the new page will discover a page with the correct settings.h]hThe new page is prepped with some settings from the old page so that accesses to the new page will discover a page with the correct settings.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKthjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h4The radix tree is changed to point to the new page. h]h)}(h3The radix tree is changed to point to the new page.h]h3The radix tree is changed to point to the new page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKwhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe reference count of the old page is dropped because the address space reference is gone. A reference to the new page is established because the new page is referenced by the address space. h]h)}(hThe reference count of the old page is dropped because the address space reference is gone. A reference to the new page is established because the new page is referenced by the address space.h]hThe reference count of the old page is dropped because the address space reference is gone. A reference to the new page is established because the new page is referenced by the address space.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKyhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe i_pages lock is dropped. With that lookups in the mapping become possible again. Processes will move from spinning on the lock to sleeping on the locked new page. h]h)}(hThe i_pages lock is dropped. With that lookups in the mapping become possible again. Processes will move from spinning on the lock to sleeping on the locked new page.h]hThe i_pages lock is dropped. With that lookups in the mapping become possible again. Processes will move from spinning on the lock to sleeping on the locked new page.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h.The page contents are copied to the new page. h]h)}(h-The page contents are copied to the new page.h]h-The page contents are copied to the new page.}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4ubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h5The remaining page flags are copied to the new page. h]h)}(h4The remaining page flags are copied to the new page.h]h4The remaining page flags are copied to the new page.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjLubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hcThe old page flags are cleared to indicate that the page does not provide any information anymore. h]h)}(hbThe old page flags are cleared to indicate that the page does not provide any information anymore.h]hbThe old page flags are cleared to indicate that the page does not provide any information anymore.}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjdubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(h2Queued up writeback on the new page is triggered. h]h)}(h1Queued up writeback on the new page is triggered.h]h1Queued up writeback on the new page is triggered.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hIf migration entries were inserted into the page table, then replace them with real ptes. Doing so will enable access for user space processes not already waiting for the page lock. h]h)}(hIf migration entries were inserted into the page table, then replace them with real ptes. Doing so will enable access for user space processes not already waiting for the page lock.h]hIf migration entries were inserted into the page table, then replace them with real ptes. Doing so will enable access for user space processes not already waiting for the page lock.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hThe page locks are dropped from the old and new page. Processes waiting on the page lock will redo their page faults and will reach the new page. h]h)}(hThe page locks are dropped from the old and new page. Processes waiting on the page lock will redo their page faults and will reach the new page.h]hThe page locks are dropped from the old and new page. Processes waiting on the page lock will redo their page faults and will reach the new page.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubj)}(hPThe new page is moved to the LRU and can be scanned by the swapper, etc. again. h]h)}(hOThe new page is moved to the LRU and can be scanned by the swapper, etc. again.h]hOThe new page is moved to the LRU and can be scanned by the swapper, etc. again.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhj)hhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhjhhhhhK^ubeh}(h]how-migrate-pages-worksah ]h"]how migrate_pages() worksah$]h&]uh1hhhhhhhhKUubh)}(hhh](h)}(hNon-LRU page migrationh]hNon-LRU page migration}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX Although migration originally aimed for reducing the latency of memory accesses for NUMA, compaction also uses migration to create high-order pages. For compaction purposes, it is also useful to be able to move non-LRU pages, such as zsmalloc and virtio-balloon pages.h]hX Although migration originally aimed for reducing the latency of memory accesses for NUMA, compaction also uses migration to create high-order pages. For compaction purposes, it is also useful to be able to move non-LRU pages, such as zsmalloc and virtio-balloon pages.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXIf a driver wants to make its pages movable, it should define a struct movable_operations. It then needs to call __SetPageMovable() on each page that it may be able to move. This uses the ``page->mapping`` field, so this field is not available for the driver to use for other purposes.h](hIf a driver wants to make its pages movable, it should define a struct movable_operations. It then needs to call __SetPageMovable() on each page that it may be able to move. This uses the }(hj hhhNhNubj)}(h``page->mapping``h]h page->mapping}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubhP field, so this field is not available for the driver to use for other purposes.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]non-lru-page-migrationah ]h"]non-lru page migrationah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hMonitoring Migrationh]hMonitoring Migration}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj1hhhhhKubh)}(hFThe following events (counters) can be used to monitor page migration.h]hFThe following events (counters) can be used to monitor page migration.}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubj)}(hhh](j)}(hXPGMIGRATE_SUCCESS: Normal page migration success. Each count means that a page was migrated. If the page was a non-THP and non-hugetlb page, then this counter is increased by one. If the page was a THP or hugetlb, then this counter is increased by the number of THP or hugetlb subpages. For example, migration of a single 2MB THP that has 4KB-size base pages (subpages) will cause this counter to increase by 512. h]h)}(hXPGMIGRATE_SUCCESS: Normal page migration success. Each count means that a page was migrated. If the page was a non-THP and non-hugetlb page, then this counter is increased by one. If the page was a THP or hugetlb, then this counter is increased by the number of THP or hugetlb subpages. For example, migration of a single 2MB THP that has 4KB-size base pages (subpages) will cause this counter to increase by 512.h]hXPGMIGRATE_SUCCESS: Normal page migration success. Each count means that a page was migrated. If the page was a non-THP and non-hugetlb page, then this counter is increased by one. If the page was a THP or hugetlb, then this counter is increased by the number of THP or hugetlb subpages. For example, migration of a single 2MB THP that has 4KB-size base pages (subpages) will cause this counter to increase by 512.}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjSubah}(h]h ]h"]h$]h&]uh1jhjPhhhhhNubj)}(hPGMIGRATE_FAIL: Normal page migration failure. Same counting rules as for PGMIGRATE_SUCCESS, above: this will be increased by the number of subpages, if it was a THP or hugetlb. h]h)}(hPGMIGRATE_FAIL: Normal page migration failure. Same counting rules as for PGMIGRATE_SUCCESS, above: this will be increased by the number of subpages, if it was a THP or hugetlb.h]hPGMIGRATE_FAIL: Normal page migration failure. Same counting rules as for PGMIGRATE_SUCCESS, above: this will be increased by the number of subpages, if it was a THP or hugetlb.}(hjohhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjkubah}(h]h ]h"]h$]h&]uh1jhjPhhhhhNubj)}(h?THP_MIGRATION_SUCCESS: A THP was migrated without being split. h]h)}(h>THP_MIGRATION_SUCCESS: A THP was migrated without being split.h]h>THP_MIGRATION_SUCCESS: A THP was migrated without being split.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjPhhhhhNubj)}(hGTHP_MIGRATION_FAIL: A THP could not be migrated nor it could be split. h]h)}(hFTHP_MIGRATION_FAIL: A THP could not be migrated nor it could be split.h]hFTHP_MIGRATION_FAIL: A THP could not be migrated nor it could be split.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjPhhhhhNubj)}(hTHP_MIGRATION_SPLIT: A THP was migrated, but not as such: first, the THP had to be split. After splitting, a migration retry was used for its sub-pages. h]h)}(hTHP_MIGRATION_SPLIT: A THP was migrated, but not as such: first, the THP had to be split. After splitting, a migration retry was used for its sub-pages.h]hTHP_MIGRATION_SPLIT: A THP was migrated, but not as such: first, the THP had to be split. After splitting, a migration retry was used for its sub-pages.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjPhhhhhNubeh}(h]h ]h"]h$]h&]jjjhjjuh1jhj1hhhhhKubh)}(hTHP_MIGRATION_* events also update the appropriate PGMIGRATE_SUCCESS or PGMIGRATE_FAIL events. For example, a THP migration failure will cause both THP_MIGRATION_FAIL and PGMIGRATE_FAIL to increase.h]hTHP_MIGRATION_* events also update the appropriate PGMIGRATE_SUCCESS or PGMIGRATE_FAIL events. For example, a THP migration failure will cause both THP_MIGRATION_FAIL and PGMIGRATE_FAIL to increase.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubh)}(h:Christoph Lameter, May 8, 2006. Minchan Kim, Mar 28, 2016.h]h:Christoph Lameter, May 8, 2006. Minchan Kim, Mar 28, 2016.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1hhubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singlemovable_operations (C struct)c.movable_operationshNtauh1jhj1hhhNhNubhdesc)}(hhh](hdesc_signature)}(hmovable_operationsh]hdesc_signature_line)}(hstruct movable_operationsh](hdesc_sig_keyword)}(hstructh]hstruct}(hjhhhNhNubah}(h]h ]kah"]h$]h&]uh1jhj hhhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKubhdesc_sig_space)}(h h]h }(hj#hhhNhNubah}(h]h ]wah"]h$]h&]uh1j!hj hhhj hKubh desc_name)}(hmovable_operationsh]h desc_sig_name)}(hjh]hmovable_operations}(hj:hhhNhNubah}(h]h ]nah"]h$]h&]uh1j8hj4ubah}(h]h ](sig-namedescnameeh"]h$]h&] xml:spacepreserveuh1j2hj hhhj hKubeh}(h]h ]h"]h$]h&]jPjQ add_permalinkuh1j sphinx_line_type declaratorhjhhhj hKubah}(h]jah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1jhj hKhjhhubh desc_content)}(hhh]h)}(hDriver page migrationh]hDriver page migration}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKhjhhhubah}(h]h ]h"]h$]h&]uh1jfhjhhhj hKubeh}(h]h ](cstructeh"]h$]h&]domainjobjtypejdesctypejnoindex noindexentrynocontentsentryuh1jhhhj1hNhNubh container)}(hXY**Definition**:: struct movable_operations { bool (*isolate_page)(struct page *, isolate_mode_t); int (*migrate_page)(struct page *dst, struct page *src, enum migrate_mode); void (*putback_page)(struct page *); }; **Members** ``isolate_page`` The VM calls this function to prepare the page to be moved. The page is locked and the driver should not unlock it. The driver should return ``true`` if the page is movable and ``false`` if it is not currently movable. After this function returns, the VM uses the page->lru field, so the driver must preserve any information which is usually stored here. ``migrate_page`` After isolation, the VM calls this function with the isolated **src** page. The driver should copy the contents of the **src** page to the **dst** page and set up the fields of **dst** page. Both pages are locked. If page migration is successful, the driver should call __ClearPageMovable(**src**) and return MIGRATEPAGE_SUCCESS. If the driver cannot migrate the page at the moment, it can return -EAGAIN. The VM interprets this as a temporary migration failure and will retry it later. Any other error value is a permanent migration failure and migration will not be retried. The driver shouldn't touch the **src->lru** field while in the migrate_page() function. It may write to **dst->lru**. ``putback_page`` If migration fails on the isolated page, the VM informs the driver that the page is no longer a candidate for migration by calling this function. The driver should put the isolated page back into its own data structure.h](h)}(h**Definition**::h](hstrong)}(h**Definition**h]h Definition}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKhjubh literal_block)}(hstruct movable_operations { bool (*isolate_page)(struct page *, isolate_mode_t); int (*migrate_page)(struct page *dst, struct page *src, enum migrate_mode); void (*putback_page)(struct page *); };h]hstruct movable_operations { bool (*isolate_page)(struct page *, isolate_mode_t); int (*migrate_page)(struct page *dst, struct page *src, enum migrate_mode); void (*putback_page)(struct page *); };}hjsbah}(h]h ]h"]h$]h&]jPjQuh1jhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKhjubh)}(h **Members**h]j)}(hjh]hMembers}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhK$hjubhdefinition_list)}(hhh](hdefinition_list_item)}(hXw``isolate_page`` The VM calls this function to prepare the page to be moved. The page is locked and the driver should not unlock it. The driver should return ``true`` if the page is movable and ``false`` if it is not currently movable. After this function returns, the VM uses the page->lru field, so the driver must preserve any information which is usually stored here. h](hterm)}(h``isolate_page``h]j)}(hjh]h isolate_page}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKhjubh definition)}(hhh]h)}(hXeThe VM calls this function to prepare the page to be moved. The page is locked and the driver should not unlock it. The driver should return ``true`` if the page is movable and ``false`` if it is not currently movable. After this function returns, the VM uses the page->lru field, so the driver must preserve any information which is usually stored here.h](hThe VM calls this function to prepare the page to be moved. The page is locked and the driver should not unlock it. The driver should return }(hjhhhNhNubj)}(h``true``h]htrue}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh if the page is movable and }(hjhhhNhNubj)}(h ``false``h]hfalse}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh if it is not currently movable. After this function returns, the VM uses the page->lru field, so the driver must preserve any information which is usually stored here.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjubj)}(hX``migrate_page`` After isolation, the VM calls this function with the isolated **src** page. The driver should copy the contents of the **src** page to the **dst** page and set up the fields of **dst** page. Both pages are locked. If page migration is successful, the driver should call __ClearPageMovable(**src**) and return MIGRATEPAGE_SUCCESS. If the driver cannot migrate the page at the moment, it can return -EAGAIN. The VM interprets this as a temporary migration failure and will retry it later. Any other error value is a permanent migration failure and migration will not be retried. The driver shouldn't touch the **src->lru** field while in the migrate_page() function. It may write to **dst->lru**. h](j)}(h``migrate_page``h]j)}(hjKh]h migrate_page}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjIubah}(h]h ]h"]h$]h&]uh1jhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhK-hjEubj)}(hhh]h)}(hXAfter isolation, the VM calls this function with the isolated **src** page. The driver should copy the contents of the **src** page to the **dst** page and set up the fields of **dst** page. Both pages are locked. If page migration is successful, the driver should call __ClearPageMovable(**src**) and return MIGRATEPAGE_SUCCESS. If the driver cannot migrate the page at the moment, it can return -EAGAIN. The VM interprets this as a temporary migration failure and will retry it later. Any other error value is a permanent migration failure and migration will not be retried. The driver shouldn't touch the **src->lru** field while in the migrate_page() function. It may write to **dst->lru**.h](h>After isolation, the VM calls this function with the isolated }(hjdhhhNhNubj)}(h**src**h]hsrc}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh3 page. The driver should copy the contents of the }(hjdhhhNhNubj)}(h**src**h]hsrc}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh page to the }(hjdhhhNhNubj)}(h**dst**h]hdst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh page and set up the fields of }(hjdhhhNhNubj)}(h**dst**h]hdst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubhi page. Both pages are locked. If page migration is successful, the driver should call __ClearPageMovable(}(hjdhhhNhNubj)}(h**src**h]hsrc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubhX<) and return MIGRATEPAGE_SUCCESS. If the driver cannot migrate the page at the moment, it can return -EAGAIN. The VM interprets this as a temporary migration failure and will retry it later. Any other error value is a permanent migration failure and migration will not be retried. The driver shouldn’t touch the }(hjdhhhNhNubj)}(h **src->lru**h]hsrc->lru}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh> field while in the migrate_page() function. It may write to }(hjdhhhNhNubj)}(h **dst->lru**h]hdst->lru}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubh.}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhK"hjaubah}(h]h ]h"]h$]h&]uh1jhjEubeh}(h]h ]h"]h$]h&]uh1jhj`hK-hjubj)}(h``putback_page`` If migration fails on the isolated page, the VM informs the driver that the page is no longer a candidate for migration by calling this function. The driver should put the isolated page back into its own data structure.h](j)}(h``putback_page``h]j)}(hjh]h putback_page}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhK2hjubj)}(hhh]h)}(hIf migration fails on the isolated page, the VM informs the driver that the page is no longer a candidate for migration by calling this function. The driver should put the isolated page back into its own data structure.h]hIf migration fails on the isolated page, the VM informs the driver that the page is no longer a candidate for migration by calling this function. The driver should put the isolated page back into its own data structure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhZ/var/lib/git/docbuild/linux/Documentation/mm/page_migration:192: ./include/linux/migrate.hhK0hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhK2hjubeh}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj1hhhNhNubeh}(h]monitoring-migrationah ]h"]monitoring migrationah$]h&]uh1hhhhhhhhKubeh}(h]page-migrationah ]h"]page migrationah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjwerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jQjNjjjjj.j+jIjFu nametypes}(jQjjj.jIuh}(jNhjj{jjj+jjFj1jju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.