diff options
| author | Harry Yoo <harry.yoo@oracle.com> | 2025-07-04 19:30:53 +0900 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-08-15 12:04:50 +0200 |
| commit | a271dc216a6b16185c9ae0f0f6057eb678fd3dfd (patch) | |
| tree | feb5e64b2c9e8dc3f9535b8de70181cf09226a90 /mm | |
| parent | 38fbab9365be46c2bfcbddb7b64245042c560511 (diff) | |
| download | linux-a271dc216a6b16185c9ae0f0f6057eb678fd3dfd.tar.gz linux-a271dc216a6b16185c9ae0f0f6057eb678fd3dfd.tar.bz2 linux-a271dc216a6b16185c9ae0f0f6057eb678fd3dfd.zip | |
mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n
commit 694d6b99923eb05a8fd188be44e26077d19f0e21 upstream.
Commit 48b4800a1c6a ("zsmalloc: page migration support") added support for
migrating zsmalloc pages using the movable_operations migration framework.
However, the commit did not take into account that zsmalloc supports
migration only when CONFIG_COMPACTION is enabled. Tracing shows that
zsmalloc was still passing the __GFP_MOVABLE flag even when compaction is
not supported.
This can result in unmovable pages being allocated from movable page
blocks (even without stealing page blocks), ZONE_MOVABLE and CMA area.
Possible user visible effects:
- Some ZONE_MOVABLE memory can be not actually movable
- CMA allocation can fail because of this
- Increased memory fragmentation due to ignoring the page mobility
grouping feature
I'm not really sure who uses kernels without compaction support, though :(
To fix this, clear the __GFP_MOVABLE flag when
!IS_ENABLED(CONFIG_COMPACTION).
Link: https://lkml.kernel.org/r/20250704103053.6913-1-harry.yoo@oracle.com
Fixes: 48b4800a1c6a ("zsmalloc: page migration support")
Signed-off-by: Harry Yoo <harry.yoo@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/zsmalloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 37f755c9a1b7..af130e2dcea2 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1049,6 +1049,9 @@ static struct zspage *alloc_zspage(struct zs_pool *pool, if (!zspage) return NULL; + if (!IS_ENABLED(CONFIG_COMPACTION)) + gfp &= ~__GFP_MOVABLE; + zspage->magic = ZSPAGE_MAGIC; migrate_lock_init(zspage); |
