[PATCH] mm/vmscan: print err before panic

From: Angus Chen
Date: Wed Sep 06 2023 - 04:38:32 EST


If panic is enable,the err information will not be printed before bugon,
So swap it.
Print the return value of PTR_ERR(pgdat->kswapd) also.

Signed-off-by: Angus Chen <angus.chen@xxxxxxxxxxxxxxx>
---
mm/vmscan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6f13394b112e..0436f0ed9671 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7892,8 +7892,9 @@ void __meminit kswapd_run(int nid)
pgdat->kswapd = kthread_run(kswapd, pgdat, "kswapd%d", nid);
if (IS_ERR(pgdat->kswapd)) {
/* failure at boot is fatal */
+ pr_err("Failed to start kswapd on node %d,ret=%ld\n",
+ nid, PTR_ERR(pgdat->kswapd));
BUG_ON(system_state < SYSTEM_RUNNING);
- pr_err("Failed to start kswapd on node %d\n", nid);
pgdat->kswapd = NULL;
}
}
--
2.25.1