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

Commit 7e21c140 authored by Jungsoo Son's avatar Jungsoo Son Committed by Laura Abbott
Browse files

page owners: correct page->order when to free page



When I use PAGE_OWNER in mmotm tree, I found a problem that mismatches the
number of allocated pages.  When I investigate, the problem is that
set_page_order is called for only a head page if freed page is merged to a
higher order page in the buddy allocator so tail pages of the higher order
page couldn't be reset to page->order = -1.

It means when we do 'cat /proc/page-owner', it could show wrong
information.

So page->order should be set to -1 for all the tail pages as well as the
first page before buddy allocator merges them.

This patch is for clearing page->order of all the tail pages in
free_pages_prepare() when to free page.

Change-Id: Iec4385efb54d3074f70209b4f373714444bebb98
Signed-off-by: default avatarJungsoo Son <jungsoo.son@lge.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: default avatarMinchan Kim <minchan@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Git-commit: 77255ec6960b14eef29eb1468dbef696c850420a
Git-repo: http://git.cmpxchg.org/cgit/linux-mmotm.git/


Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent 4855b811
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -737,6 +737,13 @@ static bool free_pages_prepare(struct page *page, unsigned int order)
	if (bad)
		return false;

#ifdef CONFIG_PAGE_OWNER
	for (i = 0; i < (1 << order); i++) {
		struct page *p = (page + i);
		p->order = -1;
	}
#endif

	if (!PageHighMem(page)) {
		debug_check_no_locks_freed(page_address(page),PAGE_SIZE<<order);
		debug_check_no_obj_freed(page_address(page),