Revert "Revert "Revert "mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask""
This reverts commit92717d429b
. Since commita8282608c8
("Revert "mm, thp: restore node-local hugepage allocations"") is reverted in this series, it is better to restore the previous 5.2 behavior between the thp allocation and the page allocator rather than to attempt any consolidation or cleanup for a policy that is now reverted. It's less risky during an rc cycle and subsequent patches in this series further modify the same policy that the pre-5.3 behavior implements. Consolidation and cleanup can be done subsequent to a sane default page allocation strategy, so this patch reverts a cleanup done on a strategy that is now reverted and thus is the least risky option. Signed-off-by: David Rientjes <rientjes@google.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Stefan Priebe - Profihost AG <s.priebe@profihost.ag> Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
このコミットが含まれているのは:
@@ -1180,8 +1180,8 @@ static struct page *new_page(struct page *page, unsigned long start)
|
||||
} else if (PageTransHuge(page)) {
|
||||
struct page *thp;
|
||||
|
||||
thp = alloc_pages_vma(GFP_TRANSHUGE, HPAGE_PMD_ORDER, vma,
|
||||
address, numa_node_id());
|
||||
thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
|
||||
HPAGE_PMD_ORDER);
|
||||
if (!thp)
|
||||
return NULL;
|
||||
prep_transhuge_page(thp);
|
||||
@@ -2083,6 +2083,7 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
|
||||
* @vma: Pointer to VMA or NULL if not available.
|
||||
* @addr: Virtual Address of the allocation. Must be inside the VMA.
|
||||
* @node: Which node to prefer for allocation (modulo policy).
|
||||
* @hugepage: for hugepages try only the preferred node if possible
|
||||
*
|
||||
* This function allocates a page from the kernel page pool and applies
|
||||
* a NUMA policy associated with the VMA or the current process.
|
||||
@@ -2093,7 +2094,7 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
|
||||
*/
|
||||
struct page *
|
||||
alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
|
||||
unsigned long addr, int node)
|
||||
unsigned long addr, int node, bool hugepage)
|
||||
{
|
||||
struct mempolicy *pol;
|
||||
struct page *page;
|
||||
@@ -2111,6 +2112,31 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (unlikely(IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && hugepage)) {
|
||||
int hpage_node = node;
|
||||
|
||||
/*
|
||||
* For hugepage allocation and non-interleave policy which
|
||||
* allows the current node (or other explicitly preferred
|
||||
* node) we only try to allocate from the current/preferred
|
||||
* node and don't fall back to other nodes, as the cost of
|
||||
* remote accesses would likely offset THP benefits.
|
||||
*
|
||||
* If the policy is interleave, or does not allow the current
|
||||
* node in its nodemask, we allocate the standard way.
|
||||
*/
|
||||
if (pol->mode == MPOL_PREFERRED && !(pol->flags & MPOL_F_LOCAL))
|
||||
hpage_node = pol->v.preferred_node;
|
||||
|
||||
nmask = policy_nodemask(gfp, pol);
|
||||
if (!nmask || node_isset(hpage_node, *nmask)) {
|
||||
mpol_cond_put(pol);
|
||||
page = __alloc_pages_node(hpage_node,
|
||||
gfp | __GFP_THISNODE, order);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
nmask = policy_nodemask(gfp, pol);
|
||||
preferred_nid = policy_node(gfp, pol, node);
|
||||
page = __alloc_pages_nodemask(gfp, order, preferred_nid, nmask);
|
||||
|
新しいイシューから参照
ユーザーをブロックする