[PATCH] makedumpfile: skip multiple pages filtered as free pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If buddy page has order n, (2^n) pages are filtered at the same
time. Then, next (2^n) pages are already filterd, so we can skip the
(2^n) pages for free.

By this, on 32GB memory system, there's the following improvement:

- with mmap() on /proc/vmcore from 0.594421 seconds to 0.496517
  seconds, and
- with normal read() from 1.533796 seconds to 0.750935 seconds.

Note that the two improvements are measured on the same /proc/vmcore.

Note also that amount of the improvement depends on amount of free
pages, though it's obvious.

Signed-off-by: HATAYAMA Daisuke <d.hatayama at jp.fujitsu.com>
---
 makedumpfile.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 7acbf72..9075f38 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -4303,9 +4303,9 @@ __exclude_unnecessary_pages(unsigned long mem_map,
 		    && info->flag_cyclic
 		    && info->page_is_buddy
 		    && info->page_is_buddy(flags, _mapcount, private, _count)) {
-			int i;
+			int i, nr_pages = 1 << private;
 
-			for (i = 0; i < (1 << private); ++i) {
+			for (i = 0; i < nr_pages; ++i) {
 				/*
 				 * According to combination of
 				 * MAX_ORDER and size of cyclic
@@ -4318,6 +4318,9 @@ __exclude_unnecessary_pages(unsigned long mem_map,
 				clear_bit_on_2nd_bitmap_for_kernel(pfn + i);
 			}
 			pfn_free += i;
+
+			pfn += nr_pages - 1;
+			mem_map += (nr_pages - 1) * SIZE(page);
 		}
 		/*
 		 * Exclude the cache page without the private page.
-- 
1.8.1.4





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux