Skip to content

Instantly share code, notes, and snippets.

@tpruzina
Last active August 14, 2018 18:48
Show Gist options
  • Save tpruzina/6fb1c1788d1eb13e9f2567a485db09ac to your computer and use it in GitHub Desktop.
Save tpruzina/6fb1c1788d1eb13e9f2567a485db09ac to your computer and use it in GitHub Desktop.
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 156ed8154af8..9df07402d801 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -916,9 +916,11 @@ void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache)
unsigned long max_swapfile_size(void)
{
- unsigned long pages;
+ unsigned long pages = 0UL;
- pages = generic_max_swapfile_size();
+#ifdef CONFIG_SWAP
+ pages = generic_max_swapfile_size();
+#endif
if (boot_cpu_has_bug(X86_BUG_L1TF)) {
/* Limit the swap file size to MAX_PA/2 for L1TF workaround */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment