refscale: Always log the error message

An OOM is a serious error that should be logged even in non-verbose runs.
This commit therefore adds an unconditional SCALEOUT_ERRSTRING() macro
and uses it instead of VERBOSE_SCALEOUT_ERRSTRING() when reporting an OOM.

[ paulmck: Drop do-while from SCALEOUT_ERRSTRING() due to only single statement. ]

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Li Zhijian 2021-10-25 11:26:58 +08:00 committed by Paul E. McKenney
parent 9880eb878c
commit 4feeb9d5f8

View File

@ -58,8 +58,7 @@ do { \
} \ } \
} while (0) } while (0)
#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \ #define SCALEOUT_ERRSTRING(s, x...) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x)
do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>"); MODULE_AUTHOR("Joel Fernandes (Google) <joel@joelfernandes.org>");
@ -651,7 +650,7 @@ static int main_func(void *arg)
result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL); result_avg = kzalloc(nruns * sizeof(*result_avg), GFP_KERNEL);
buf = kzalloc(800 + 64, GFP_KERNEL); buf = kzalloc(800 + 64, GFP_KERNEL);
if (!result_avg || !buf) { if (!result_avg || !buf) {
VERBOSE_SCALEOUT_ERRSTRING("out of memory"); SCALEOUT_ERRSTRING("out of memory");
goto oom_exit; goto oom_exit;
} }
if (holdoff) if (holdoff)
@ -837,7 +836,7 @@ ref_scale_init(void)
reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]), reader_tasks = kcalloc(nreaders, sizeof(reader_tasks[0]),
GFP_KERNEL); GFP_KERNEL);
if (!reader_tasks) { if (!reader_tasks) {
VERBOSE_SCALEOUT_ERRSTRING("out of memory"); SCALEOUT_ERRSTRING("out of memory");
firsterr = -ENOMEM; firsterr = -ENOMEM;
goto unwind; goto unwind;
} }