Unverified Commit 773f7318 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14326 mm: Backport mainline patch

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/QAJPZNWU2AHJ7SICNVN3SIZ6M2CPQPDV/ 
Kemeng Shi (1):
  mm/compaction: correctly return failure with bogus compound_order in

Xueshi Hu (1):
  mm/hugetlb: fix nodes huge page allocation when there are surplus
    pages


-- 
2.34.1
 
https://gitee.com/openeuler/kernel/issues/IBE66K 
 
Link:https://gitee.com/openeuler/kernel/pulls/14326

 

Reviewed-by: default avatarYuan Can <yuancan@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarYuan Can <yuancan@huawei.com>
parents 9ddc34ea fdbe4cbc
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -476,10 +476,11 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
		if (PageCompound(page)) {
			const unsigned int order = compound_order(page);

			if (likely(order < MAX_ORDER)) {
			if (blockpfn + (1UL << order) <= end_pfn) {
				blockpfn += (1UL << order) - 1;
				cursor += (1UL << order) - 1;
			}

			goto isolate_fail;
		}

@@ -544,8 +545,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
		spin_unlock_irqrestore(&cc->zone->lock, flags);

	/*
	 * There is a tiny chance that we have read bogus compound_order(),
	 * so be careful to not go outside of the pageblock.
	 * Be careful to not go outside of the pageblock.
	 */
	if (unlikely(blockpfn > end_pfn))
		blockpfn = end_pfn;
+3 −1
Original line number Diff line number Diff line
@@ -2837,7 +2837,9 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count,
	if (nid != NUMA_NO_NODE) {
		unsigned long old_count = count;

		count += h->nr_huge_pages - h->nr_huge_pages_node[nid];
		count += persistent_huge_pages(h) -
			 (h->nr_huge_pages_node[nid] -
			  h->surplus_huge_pages_node[nid]);
		/*
		 * User may have specified a large count value which caused the
		 * above calculation to overflow.  In this case, they wanted