[LTP] [PATCH v5] kill01: New case cgroup kill
Petr Vorel
pvorel@suse.cz
Thu Mar 9 22:40:46 CET 2023
Hi Wei,
Closes: https://github.com/linux-test-project/ltp/issues/846
Test LGTM.
...
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2012 Christian Brauner <brauner-AT-kernel.org>
Is it based on some Christian's reproducer?
I haven't noticed any in https://lwn.net/Articles/855049/ (linked in #846)
nor in the patch
https://lwn.net/ml/cgroups/20210503143922.3093755-1-brauner@kernel.org/.
But maybe I just overlooked it.
> + * Copyright (c) 2023 SUSE LLC <wegao@suse.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * Basic cgroup kill test.
> + *
> + */
> +
> +#include <errno.h>
> +#include <linux/limits.h>
> +#include <stdbool.h>
nit: stdbool.h is not needed (can be removed before merge).
...
> +static void run(void)
> +{
> + pid_t pids[MAX_PID_NUM];
> + int i;
> +
> + cg_child_test_simple = tst_cg_group_mk(tst_cg, "cg_test_simple");
> +
> + memset(buf, 0, buf_len);
> +
> + for (i = 0; i < pid_num; i++)
> + pids[i] = cg_run_nowait(cg_child_test_simple, child_fn);
> +
> + TST_EXP_PASS(cg_wait_for_proc_count(cg_child_test_simple, pid_num));
> + SAFE_CG_PRINTF(cg_child_test_simple, "cgroup.kill", "%d", 1);
> +
> + for (i = 0; i < pid_num; i++) {
> + /* wait_for_pid(pids[i]); */
I guess this comment should be removed before merge.
> + TST_EXP_PASS_SILENT(wait_for_pid(pids[i]) == SIGKILL);
> + }
> +
> + cg_child_test_simple = tst_cg_group_rm(cg_child_test_simple);
> +}
Kind regards,
Petr
More information about the ltp
mailing list