From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3B3C306D3F; Tue, 26 Aug 2025 14:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218191; cv=none; b=AC1WSk1lnSBE2E0FZjZi3pOK72lq1EOnok5sa6AxDk8JvDs/UD4giWTGMJzhqcPr9XTfWUL9tJR/LS5TfmHwrwTThWVsEJbArcswUa9i85+ExgYxQWZ0m3q6U+zrKa96A52yeyOsHmu4lvit/FdyrLXajrLzKhewEnrTh1Qrv40= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756218191; c=relaxed/simple; bh=fJmEWC26G2Hm/+gcWEHunG67tczuEuwhPE5xZaui7us=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vj7WXcc8ThRIx7EWdPbBQfVu5MzXR5XI6l14Z4p8kNZHLbX28zSAYIgC+kgEJ6pWXsBh46K9rYsQ/OmkPpBpAHfsEBky7598495yb7d4GU+Q0ebDSoxW8cMemzaTQfrCsAA+8GJQp0sHKeAiWCMCkJl6ANfaD/Fizfl+lpaoLNM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=jY8ELIrN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="jY8ELIrN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 833D6C4CEF1; Tue, 26 Aug 2025 14:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756218190; bh=fJmEWC26G2Hm/+gcWEHunG67tczuEuwhPE5xZaui7us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jY8ELIrNOp0YBxS2KH0DG6pCJcuQRUdw/oqKBcU4r5tGKrm19X4p9O1VSpFARBH+q YzUDkPNvSjHHlSW7xd83PW6nLLa9L4i2mldog6CxmjFcrJV57eKyTBvuY0wZu6KKN2 8gfFLrwpNYFd1UpmrrKw7K2x7pz8aUryPuz1BWaA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Harry Yoo , David Hildenbrand , Sergey Senozhatsky , Minchan Kim , Andrew Morton , Sasha Levin Subject: [PATCH 5.10 427/523] mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n Date: Tue, 26 Aug 2025 13:10:37 +0200 Message-ID: <20250826110934.989241784@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110924.562212281@linuxfoundation.org> References: <20250826110924.562212281@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Harry Yoo [ Upstream commit 694d6b99923eb05a8fd188be44e26077d19f0e21 ] 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 Acked-by: David Hildenbrand Reviewed-by: Sergey Senozhatsky Cc: Minchan Kim Cc: Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- mm/zsmalloc.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1067,6 +1067,9 @@ static struct zspage *alloc_zspage(struc if (!zspage) return NULL; + if (!IS_ENABLED(CONFIG_COMPACTION)) + gfp &= ~__GFP_MOVABLE; + zspage->magic = ZSPAGE_MAGIC; migrate_lock_init(zspage);