From: Weijie Yang <weijie.yang@samsung.com>
To: kamezawa.hiroyu@jp.fujitsu.com, 'Minchan Kim' <minchan@kernel.org>
Cc: 'Andrew Morton' <akpm@linux-foundation.org>,
mgorman@suse.de, mina86@mina86.com,
'linux-kernel' <linux-kernel@vger.kernel.org>,
'Linux-MM' <linux-mm@kvack.org>,
'Weijie Yang' <weijie.yang.kh@gmail.com>
Subject: [PATCH 2/2] mm: page_isolation: fix zone_freepage accounting
Date: Thu, 06 Nov 2014 16:09:08 +0800 [thread overview]
Message-ID: <000101cff999$09225070$1b66f150$%yang@samsung.com> (raw)
If race between isolatation and allocation happens, we could need to move
some freepages to MIGRATE_ISOLATE in __test_page_isolated_in_pageblock().
The current code ignores the zone_freepage accounting after the move,
which cause the zone NR_FREE_PAGES and NR_FREE_CMA_PAGES statistics incorrect.
This patch fixes this rare issue.
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
---
mm/page_isolation.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/mm/page_isolation.c b/mm/page_isolation.c
index 3ddc8b3..15b51de 100644
--- a/mm/page_isolation.c
+++ b/mm/page_isolation.c
@@ -193,12 +193,15 @@ __test_page_isolated_in_pageblock(unsigned long pfn, unsigned long end_pfn,
* is MIGRATE_ISOLATE. Catch it and move the page into
* MIGRATE_ISOLATE list.
*/
- if (get_freepage_migratetype(page) != MIGRATE_ISOLATE) {
+ int migratetype = get_freepage_migratetype(page);
+ if (migratetype != MIGRATE_ISOLATE) {
struct page *end_page;
end_page = page + (1 << page_order(page)) - 1;
move_freepages(page_zone(page), page, end_page,
MIGRATE_ISOLATE);
+ __mod_zone_freepage_state(zone,
+ -(1 << page_order(page)), migratetype);
}
pfn += 1 << page_order(page);
}
--
1.7.0.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2014-11-06 8:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 8:09 Weijie Yang [this message]
2014-11-06 8:49 ` Joonsoo Kim
2014-11-07 2:47 ` Weijie Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000101cff999$09225070$1b66f150$%yang@samsung.com' \
--to=weijie.yang@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mina86@mina86.com \
--cc=minchan@kernel.org \
--cc=weijie.yang.kh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox