All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] fix freepage count problems in memory isolation
@ 2014-08-06  7:18 ` Joonsoo Kim
  0 siblings, 0 replies; 84+ messages in thread
From: Joonsoo Kim @ 2014-08-06  7:18 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A. Shutemov, Rik van Riel, Mel Gorman, Johannes Weiner,
	Minchan Kim, Yasuaki Ishimatsu, Zhang Yanfei, Srivatsa S. Bhat,
	Tang Chen, Naoya Horiguchi, Bartlomiej Zolnierkiewicz,
	Wen Congyang, Marek Szyprowski, Michal Nazarewicz, Laura Abbott,
	Heesub Shin, Aneesh Kumar K.V, Ritesh Harjani, t.stanislaws,
	Gioh Kim, linux-mm, linux-kernel, Joonsoo Kim

Hello,

This patchset aims at fixing problems during memory isolation found by
testing my patchset [1].

These are really subtle problems so I can be wrong. If you find what I am
missing, please let me know.

Before describing bugs itself, I first explain definition of freepage.

1. pages on buddy list are counted as freepage.
2. pages on isolate migratetype buddy list are *not* counted as freepage.
3. pages on cma buddy list are counted as CMA freepage, too.
4. pages for guard are *not* counted as freepage.

Now, I describe problems and related patch.

Patch 1: If guard page are cleared and merged into isolate buddy list,
we should not add freepage count.

Patch 4: There is race conditions that results in misplacement of free
pages on buddy list. Then, it results in incorrect freepage count and
un-availability of freepage.

Patch 5: To count freepage correctly, we should prevent freepage from
being added to buddy list in some period of isolation. Without it, we
cannot be sure if the freepage is counted or not and miscount number
of freepage.

Patch 7: In spite of above fixes, there is one more condition for
incorrect freepage count. pageblock isolation could be done in pageblock
unit  so we can't prevent freepage from merging with page on next
pageblock. To fix it, start_isolate_page_range() and
undo_isolate_page_range() is modified to process whole range at one go.
With this change, if input parameter of start_isolate_page_range() and
undo_isolate_page_range() is properly aligned, there is no condition for
incorrect merging.

Without patchset [1], above problem doesn't happens on my CMA allocation
test, because CMA reserved pages aren't used at all. So there is no
chance for above race.

With patchset [1], I did simple CMA allocation test and get below result.

- Virtual machine, 4 cpus, 1024 MB memory, 256 MB CMA reservation
- run kernel build (make -j16) on background
- 30 times CMA allocation(8MB * 30 = 240MB) attempts in 5 sec interval
- Result: more than 5000 freepage count are missed

With patchset [1] and this patchset, I found that no freepage count are
missed so that I conclude that problems are solved.

These problems can be possible on memory hot remove users, although
I didn't check it further.

This patchset is based on linux-next-20140728.
Please see individual patches for more information.

Thanks.

[1]: Aggressively allocate the pages on cma reserved memory
     https://lkml.org/lkml/2014/5/30/291

Joonsoo Kim (8):
  mm/page_alloc: correct to clear guard attribute in DEBUG_PAGEALLOC
  mm/isolation: remove unstable check for isolated page
  mm/page_alloc: fix pcp high, batch management
  mm/isolation: close the two race problems related to pageblock
    isolation
  mm/isolation: change pageblock isolation logic to fix freepage
    counting bugs
  mm/isolation: factor out pre/post logic on
    set/unset_migratetype_isolate()
  mm/isolation: fix freepage counting bug on
    start/undo_isolat_page_range()
  mm/isolation: remove useless race handling related to pageblock
    isolation

 include/linux/page-isolation.h |    2 +
 mm/internal.h                  |    5 +
 mm/page_alloc.c                |  223 +++++++++++++++++-------------
 mm/page_isolation.c            |  292 +++++++++++++++++++++++++++++++---------
 4 files changed, 368 insertions(+), 154 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 84+ messages in thread

end of thread, other threads:[~2014-08-13  8:29 UTC | newest]

Thread overview: 84+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-06  7:18 [PATCH v2 0/8] fix freepage count problems in memory isolation Joonsoo Kim
2014-08-06  7:18 ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 1/8] mm/page_alloc: correct to clear guard attribute in DEBUG_PAGEALLOC Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-07  1:46   ` Zhang Yanfei
2014-08-07  1:46     ` Zhang Yanfei
2014-08-06  7:18 ` [PATCH v2 1/8] mm/page_alloc: fix pcp high, batch management Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-12  1:24   ` Minchan Kim
2014-08-12  1:24     ` Minchan Kim
2014-08-13  8:13     ` Joonsoo Kim
2014-08-13  8:13       ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 2/8] mm/isolation: remove unstable check for isolated page Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-07 13:49   ` Vlastimil Babka
2014-08-07 13:49     ` Vlastimil Babka
2014-08-08  6:22     ` Joonsoo Kim
2014-08-08  6:22       ` Joonsoo Kim
2014-08-11  9:23   ` Aneesh Kumar K.V
2014-08-11  9:23     ` Aneesh Kumar K.V
2014-08-13  8:19     ` Joonsoo Kim
2014-08-13  8:19       ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 2/8] mm/page_alloc: correct to clear guard attribute in DEBUG_PAGEALLOC Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-12  1:45   ` Minchan Kim
2014-08-12  1:45     ` Minchan Kim
2014-08-13  8:20     ` Joonsoo Kim
2014-08-13  8:20       ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 3/8] mm/isolation: remove unstable check for isolated page Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 3/8] mm/page_alloc: fix pcp high, batch management Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-07  2:11   ` Zhang Yanfei
2014-08-07  2:11     ` Zhang Yanfei
2014-08-07  8:23     ` Joonsoo Kim
2014-08-07  8:23       ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 4/8] mm/isolation: close the two race problems related to pageblock isolation Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-07 14:34   ` Vlastimil Babka
2014-08-07 14:34     ` Vlastimil Babka
2014-08-08  6:30     ` Joonsoo Kim
2014-08-08  6:30       ` Joonsoo Kim
2014-08-12  5:17   ` Minchan Kim
2014-08-12  5:17     ` Minchan Kim
2014-08-12  9:45     ` Vlastimil Babka
2014-08-12  9:45       ` Vlastimil Babka
2014-08-13  8:09       ` Joonsoo Kim
2014-08-13  8:09         ` Joonsoo Kim
2014-08-13  8:29     ` Joonsoo Kim
2014-08-13  8:29       ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 5/8] mm/isolation: change pageblock isolation logic to fix freepage counting bugs Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-06 15:12   ` Vlastimil Babka
2014-08-06 15:12     ` Vlastimil Babka
2014-08-07  8:19     ` Joonsoo Kim
2014-08-07  8:19       ` Joonsoo Kim
2014-08-07  8:53       ` Vlastimil Babka
2014-08-07  8:53         ` Vlastimil Babka
2014-08-07 12:26         ` Joonsoo Kim
2014-08-07 12:26           ` Joonsoo Kim
2014-08-07 13:04           ` Vlastimil Babka
2014-08-07 13:04             ` Vlastimil Babka
2014-08-07 13:35             ` Joonsoo Kim
2014-08-07 13:35               ` Joonsoo Kim
2014-08-07 15:15   ` Vlastimil Babka
2014-08-07 15:15     ` Vlastimil Babka
2014-08-08  6:45     ` Joonsoo Kim
2014-08-08  6:45       ` Joonsoo Kim
2014-08-12  6:43   ` Minchan Kim
2014-08-12  6:43     ` Minchan Kim
2014-08-12 10:58     ` Vlastimil Babka
2014-08-12 10:58       ` Vlastimil Babka
2014-08-06  7:18 ` [PATCH v2 6/8] mm/isolation: factor out pre/post logic on set/unset_migratetype_isolate() Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 7/8] mm/isolation: fix freepage counting bug on start/undo_isolat_page_range() Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-06  7:18 ` [PATCH v2 8/8] mm/isolation: remove useless race handling related to pageblock isolation Joonsoo Kim
2014-08-06  7:18   ` Joonsoo Kim
2014-08-06  7:25 ` [PATCH v2 0/8] fix freepage count problems in memory isolation Joonsoo Kim
2014-08-06  7:25   ` Joonsoo Kim
2014-08-07  0:49 ` Zhang Yanfei
2014-08-07  0:49   ` Zhang Yanfei
2014-08-07  8:20   ` Joonsoo Kim
2014-08-07  8:20     ` Joonsoo Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.