Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bb7dc3b authored by junj's avatar junj Committed by Charan Teja Reddy
Browse files

Revert "mm, page_alloc: fix core hung in free_pcppages_bulk()"



This reverts commit c1d75807 ("mm, page_alloc: fix core hung in
free_pcppages_bulk()) as it is causing the below crash.

(new_slab) from [<c02d728c>]
(__kmem_cache_create) from [<c1a22468>] (create_boot_cache+0x6c/0x94)
(create_boot_cache) from [<c1a24e38>] (kmem_cache_init+0x74/0x16c)
(kmem_cache_init) from [<c1a009d0>] (start_kernel+0x340/0x680)
(start_kernel) from [<00000000>] (  (null))

Reason being that pages are not being initialized properly as they first
goto pcplists rather than buddy explained in the below call flow:
Start_kernel() -->
	build_all_zonelists()-> pcp's ->batch = 1, ->high = 0,
	mm_init()->mem_init()->free_all_bootmem()--> add order-0 pages to
				pcp lists rather then to buddy.

	alloc_pages() -> This will cause crash as some of the page
			struct are not reliable.

Change-Id: I693fca5c7ef7f1d034355fc761fa623d4e78227d
Signed-off-by: default avatarjunj <junj@codeaurora.org>
[charante@codeaurora.org]: updated the details in commit message
Signed-off-by: default avatarCharan Teja Reddy <charante@codeaurora.org>
parent 67938f3f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -3036,7 +3036,7 @@ static void free_unref_page_commit(struct page *page, unsigned long pfn)
{
	struct zone *zone = page_zone(page);
	struct per_cpu_pages *pcp;
	int migratetype, high, batch;
	int migratetype;

	migratetype = get_pcppage_migratetype(page);
	__count_vm_event(PGFREE);
@@ -3059,11 +3059,11 @@ static void free_unref_page_commit(struct page *page, unsigned long pfn)
	pcp = &this_cpu_ptr(zone->pageset)->pcp;
	list_add(&page->lru, &pcp->lists[migratetype]);
	pcp->count++;
	high = READ_ONCE(pcp->high);
	batch = READ_ONCE(pcp->batch);
	if ((high > batch) && pcp->count >= high)
	if (pcp->count >= pcp->high) {
		unsigned long batch = READ_ONCE(pcp->batch);
		free_pcppages_bulk(zone, batch, pcp);
	}
}

/*
 * Free a 0-order page