Skip to contentSkip to conversation

mm/swap_slots.c: add warning if swap slots cache failed to initialize

PATCH New [email protected] 1 participant 1 message May 3, 2017 Memory management

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 63/102 mm/swap_slots.c: add warning if swap slots cache failed to initialize

From: Tim Chen <[email protected]>
Subject: mm/swap_slots.c: add warning if swap slots cache failed to initialize

Add a warning diagnostics to user if we failed to allocate swap slots cache and use it.

---

 mm/swap_slots.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/swap_slots.c renamed from mm/swap_slots.c~swap-add-warning-if-swap-slots-cache-failed-to-initialize +3 -1
diff -puN mm/swap_slots.c~swap-add-warning-if-swap-slots-cache-failed-to-initialize mm/swap_slots.c
@@ -241,8 +241,10 @@ int enable_swap_slots_cache(void)
 
 	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "swap_slots_cache",
 				alloc_swap_slot_cache, free_slot_cache);
-	if (ret < 0)
+	if (WARN_ONCE(ret < 0, "Cache allocation failed (%s), operating "
+			       "without swap slots cache.\n", __func__))
 		goto out_unlock;
+
 	swap_slot_cache_initialized = true;
 	__reenable_swap_slots_cache();
 out_unlock:

_