Unverified Commit 0c1630bd authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11562 Backport bugfix from mainline

Merge Pull Request from: @ci-robot 
 
PR sync from: Liu Shixin <liushixin2@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/X632U367JNSO5EQ2ISIPOXGK2WDIZBBX/ 
Gavin Shan (1):
  mm: migrate: fix THP's mapcount on isolation

Kemeng Shi (1):
  mm/compaction: correctly return failure with bogus compound_order in

Liu Shixin (2):
  bootmem: remove the vmemmap pages from kmemleak in free_bootmem_page
  bootmem: use kmemleak_free_part_phys in free_bootmem_page

Naoya Horiguchi (1):
  mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all()

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

Yuan Can (1):
  mm: hugetlb_vmemmap: fix hugetlb page number decrease failed on
    movable nodes


-- 
2.34.1
 
https://gitee.com/openeuler/kernel/issues/IAR7B3 
 
Link:https://gitee.com/openeuler/kernel/pulls/11562

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 287ff289 5d2cd426
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#define __LINUX_BOOTMEM_INFO_H

#include <linux/mm.h>
#include <linux/kmemleak.h>

/*
 * Types for free bootmem stored in page->lru.next. These have to be in
@@ -59,6 +60,7 @@ static inline void get_page_bootmem(unsigned long info, struct page *page,

static inline void free_bootmem_page(struct page *page)
{
	kmemleak_free_part_phys(PFN_PHYS(page_to_pfn(page)), PAGE_SIZE);
	free_reserved_page(page);
}
#endif
+14 −14
Original line number Diff line number Diff line
@@ -599,10 +599,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;
		}

@@ -657,8 +658,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;
@@ -965,29 +965,29 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
			goto isolate_fail;
		}

		/*
		 * Be careful not to clear PageLRU until after we're
		 * sure the page is not being freed elsewhere -- the
		 * page release code relies on it.
		 */
		if (unlikely(!get_page_unless_zero(page)))
			goto isolate_fail;

		/*
		 * Migration will fail if an anonymous page is pinned in memory,
		 * so avoid taking lru_lock and isolating it unnecessarily in an
		 * admittedly racy check.
		 */
		if (!page_mapping(page) &&
		    page_count(page) > page_mapcount(page))
			goto isolate_fail;
		    (page_count(page) - 1) > total_mapcount(page))
			goto isolate_fail_put;

		/*
		 * Only allow to migrate anonymous pages in GFP_NOFS context
		 * because those do not depend on fs locks.
		 */
		if (!(cc->gfp_mask & __GFP_FS) && page_mapping(page))
			goto isolate_fail;

		/*
		 * Be careful not to clear PageLRU until after we're
		 * sure the page is not being freed elsewhere -- the
		 * page release code relies on it.
		 */
		if (unlikely(!get_page_unless_zero(page)))
			goto isolate_fail;
			goto isolate_fail_put;

		if (__isolate_lru_page_prepare(page, isolate_mode) != 0)
			goto isolate_fail_put;
+2 −5
Original line number Diff line number Diff line
@@ -2882,11 +2882,8 @@ static int split_huge_pages_set(void *data, u64 val)
	for_each_populated_zone(zone) {
		max_zone_pfn = zone_end_pfn(zone);
		for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++) {
			if (!pfn_valid(pfn))
				continue;

			page = pfn_to_page(pfn);
			if (!get_page_unless_zero(page))
			page = pfn_to_online_page(pfn);
			if (!page || !get_page_unless_zero(page))
				continue;

			if (zone != page_zone(page))
+3 −1
Original line number Diff line number Diff line
@@ -3048,7 +3048,9 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
	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
+1 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ int hugetlb_vmemmap_alloc(struct hstate *h, struct page *head)
	 * discarded vmemmap pages must be allocated and remapping.
	 */
	ret = vmemmap_remap_alloc(vmemmap_addr, vmemmap_end, vmemmap_reuse,
				  GFP_KERNEL | __GFP_NORETRY | __GFP_THISNODE);
				  GFP_KERNEL | __GFP_NORETRY);
	if (!ret) {
		ClearHPageVmemmapOptimized(head);
		static_branch_dec(&hugetlb_optimize_vmemmap_key);