Re: [PATCH v3 21/26] mm/page_alloc: implement FREETYPE_UNMAPPED allocations
Yosry Ahmed <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <CAO9r8zODy9UCrtJuU5_SuiZDUbg4dUYLhOyOwZtD-U0N0tpCsA@mail.gmail.com> |
> diff --git a/mm/compaction.c b/mm/compaction.c > index 67b01af024e17..c9eb3947ffc79 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -1393,6 +1393,9 @@ static bool suitable_migration_source(struct compact_control *cc, > block_ft = get_pageblock_freetype(page); > block_mt = free_to_migratetype(block_ft); > > + if (freetype_unmapped(get_pageblock_freetype(page))) > + return false; > + > /* > * CMA pages can only be taken by ALLOC_CMA requests. For anybody > * else, vacating a CMA block consumes free pages the caller > @@ -1444,6 +1447,9 @@ static bool suitable_migration_target(struct compact_control *cc, > return false; > } > > + if (freetype_unmapped(get_pageblock_freetype(page))) > + return false; > + Do we also want to add safety checks in the page migration code? IIUC, if we miss a check in the compaction code and try to compact an unmapped pageblock the kernel will crash with a #PF in supervisor mode. > if (cc->ignore_block_suitable) > return true; >