]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/reclaim: schedule 'damon_reclaim_timer' only after 'system_wq' is initialized
authorSeongJae Park <sj@kernel.org>
Sat, 4 Jun 2022 19:50:51 +0000 (19:50 +0000)
committerakpm <akpm@linux-foundation.org>
Fri, 17 Jun 2022 02:11:30 +0000 (19:11 -0700)
commitbdcc966c668d854e58f23a10de08e00c76fc59f4
treee0f683505497ac250591c65d7a60f7a681eb649a
parent23c0f54656f03788e22bbc230179162617962413
mm/damon/reclaim: schedule 'damon_reclaim_timer' only after 'system_wq' is initialized

Commit 6c8e96205347 ("mm/damon/reclaim: fix the timer always stays
active") made DAMON_RECLAIM's 'enabled' parameter store callback,
'enabled_store()', to schedule 'damon_reclaim_timer'.  The scheduling uses
'system_wq', which is initialized in 'workqueue_init_early()'.  As kernel
parameters parsing function ('parse_args()') is called before
'workqueue_init_early()', 'enabled_store()' can be executed before
'workqueue_init_early()' and end up accessing the uninitialized
'system_wq'.  As a result, the booting hang[1].  This commit fixes the
issue by checking if the initialization is done before scheduling the
timer.

[1] https://lkml.kernel.org/20220604192222.1488-1-sj@kernel.org/

Link: https://lkml.kernel.org/r/20220604195051.1589-1-sj@kernel.org
Fixes: 6c8e96205347 ("mm/damon/reclaim: fix the timer always stays active")
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Greg White <gwhite@kupulau.com>
Cc: Hailong Tu <tuhailong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/reclaim.c