On Wed, Nov 09, 2022 at 05:41:12AM +0000, Akira Naribayashi (Fujitsu) wrote: > On Mon, 7 Nov 2022 15:43:56 +0000, Mei Gorman wrote: > > On Mon, Nov 07, 2022 at 12:32:34PM +0000, Akira Naribayashi (Fujitsu) wrote: > > > > Under what circumstances will this panic occur? I assume those > > > > circumstnces are pretty rare, give that 6e2b7044c1992 was nearly two > > > > years ago. > > > > > > > > Did you consider the desirability of backporting this fix into earlier > > > > kernels? > > > > > > > > > Panic can occur on systems with multiple zones in a single pageblock. > > > > > > > Please provide an example of the panic and the zoneinfo. > > This issue is occurring in our customer's environment and cannot > be shared publicly as it contains customer information. > Also, the panic is occurring with the kernel in RHEL and may not > panic with Upstream's community kernel. > In other words, it is possible to panic on older kernels. > I think this fix should be backported to stable kernel series. > > > > The reason it is rare is that it only happens in special configurations. > > > > How is this special configuration created? > > This is the case when the node boundary is not aligned to pageblock boundary. In that case, does this work to avoid rescanning an area that was already isolated? diff --git a/mm/compaction.c b/mm/compaction.c index c51f7f545afe..58cf73ff20ff 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1346,7 +1346,7 @@ move_freelist_tail(struct list_head *freelist, struct page *freepage) static void fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long nr_isolated) { - unsigned long start_pfn, end_pfn; + unsigned long start_pfn, end_pfn, isolated_end; struct page *page; /* Do not search around if there are enough pages already */ @@ -1361,6 +1361,10 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long start_pfn = max(pageblock_start_pfn(pfn), cc->zone->zone_start_pfn); end_pfn = min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)); + /* Pageblock may straddle zone/node boundaries */ + isolated_end = pfn + nr_isolated; + pfn = clamp(pfn, start_pfn, end_pfn); + page = pageblock_pfn_to_page(start_pfn, end_pfn, cc->zone); if (!page) return; @@ -1373,7 +1377,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long } /* Scan after */ - start_pfn = pfn + nr_isolated; + start_pfn = isolated_end; if (start_pfn < end_pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);