From: Haojian Zhuang <haojian.zhuang@gmail.com>
To: dave.hansen@intel.com, m.szyprowski@samsung.com,
akpm@linux-foundation.org, mgorman@suse.de, linux-mm@kvack.org
Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
Subject: [PATCH v2] mm: vmscan: decrease cma pages from nr_reclaimed
Date: Tue, 13 Aug 2013 09:07:42 +0800 [thread overview]
Message-ID: <1376356062-25200-1-git-send-email-haojian.zhuang@gmail.com> (raw)
In-Reply-To: <52092FB5.3060300@intel.com>
shrink_page_list() reclaims the pages. But the statistical data may
be inaccurate since some pages are CMA pages. If kernel needs to
reclaim unmovable memory (GFP_KERNEL flag), free CMA pages should not
be counted in nr_reclaimed pages.
v2:
* Remove #ifdef CONFIG_CMA. Use IS_ENABLED() & is_migrate_cma() instead.
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
mm/vmscan.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2cff0d4..414f74f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -720,6 +720,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
unsigned long nr_reclaimed = 0;
unsigned long nr_writeback = 0;
unsigned long nr_immediate = 0;
+ /* Number of pages freed with MIGRATE_CMA type */
+ unsigned long nr_reclaimed_cma = 0;
+ int mt = 0;
cond_resched();
@@ -987,6 +990,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
* leave it off the LRU).
*/
nr_reclaimed++;
+ mt = get_pageblock_migratetype(page);
+ if (is_migrate_cma(mt))
+ nr_reclaimed_cma++;
continue;
}
}
@@ -1005,6 +1011,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
__clear_page_locked(page);
free_it:
nr_reclaimed++;
+ mt = get_pageblock_migratetype(page);
+ if (is_migrate_cma(mt))
+ nr_reclaimed_cma++;
/*
* Is there need to periodically free_page_list? It would
@@ -1044,6 +1053,11 @@ keep:
*ret_nr_unqueued_dirty += nr_unqueued_dirty;
*ret_nr_writeback += nr_writeback;
*ret_nr_immediate += nr_immediate;
+ if (IS_ENABLED(CONFIG_CMA)) {
+ mt = allocflags_to_migratetype(sc->gfp_mask);
+ if (mt == MIGRATE_UNMOVABLE)
+ nr_reclaimed -= nr_reclaimed_cma;
+ }
return nr_reclaimed;
}
--
1.8.1.2
--
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 prev parent reply other threads:[~2013-08-13 1:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-12 15:51 [PATCH] " Haojian Zhuang
2013-08-12 18:55 ` Dave Hansen
2013-08-12 23:43 ` Haojian Zhuang
2013-08-13 1:07 ` Haojian Zhuang [this message]
2013-08-13 1:35 ` [PATCH v2] " Minchan Kim
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=1376356062-25200-1-git-send-email-haojian.zhuang@gmail.com \
--to=haojian.zhuang@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=linux-mm@kvack.org \
--cc=m.szyprowski@samsung.com \
--cc=mgorman@suse.de \
/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