+/* Verify that KSM can be enabled / queried with prctl. */ +static void test_prctl(void) +{
- int ret;
- ksft_print_msg("[RUN] %s\n", __func__);
- ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0);
- if (ret < 0 && errno == EINVAL) {
ksft_test_result_skip("PR_SET_MEMORY_MERGE not supported\n");
return;
- } else if (ret) {
ksft_test_result_fail("PR_SET_MEMORY_MERGE=1 failed\n");
- }
Just realized we're missing a "return;" in case of the failure here.
On 17.04.23 16:35, David Hildenbrand wrote:
+/* Verify that KSM can be enabled / queried with prctl. */ +static void test_prctl(void) +{
- int ret;
- ksft_print_msg("[RUN] %s\n", __func__);
- ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0);
- if (ret < 0 && errno == EINVAL) {
ksft_test_result_skip("PR_SET_MEMORY_MERGE not supported\n");
return;
- } else if (ret) {
ksft_test_result_fail("PR_SET_MEMORY_MERGE=1 failed\n");
- }
Just realized we're missing a "return;" in case of the failure here.
And we should probably fix that as well:
ERROR: do not initialise globals to 0 #235: FILE: tools/testing/selftests/mm/ksm_tests.c:57: +int debug = 0;
total: 1 errors, 0 warnings, 512 lines checked
David Hildenbrand david@redhat.com writes:
On 17.04.23 16:35, David Hildenbrand wrote:
+/* Verify that KSM can be enabled / queried with prctl. */ +static void test_prctl(void) +{
- int ret;
- ksft_print_msg("[RUN] %s\n", __func__);
- ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0);
- if (ret < 0 && errno == EINVAL) {
ksft_test_result_skip("PR_SET_MEMORY_MERGE not supported\n");
return;
- } else if (ret) {
ksft_test_result_fail("PR_SET_MEMORY_MERGE=1 failed\n");
- }
Just realized we're missing a "return;" in case of the failure here.
And we should probably fix that as well:
ERROR: do not initialise globals to 0 #235: FILE: tools/testing/selftests/mm/ksm_tests.c:57: +int debug = 0;
total: 1 errors, 0 warnings, 512 lines checked
I'll fix it in the next version.'
David Hildenbrand david@redhat.com writes:
+/* Verify that KSM can be enabled / queried with prctl. */ +static void test_prctl(void) +{
- int ret;
- ksft_print_msg("[RUN] %s\n", __func__);
- ret = prctl(PR_SET_MEMORY_MERGE, 1, 0, 0, 0);
- if (ret < 0 && errno == EINVAL) {
ksft_test_result_skip("PR_SET_MEMORY_MERGE not supported\n");
return;
- } else if (ret) {
ksft_test_result_fail("PR_SET_MEMORY_MERGE=1 failed\n");
- }
Just realized we're missing a "return;" in case of the failure here.
I'll fix it in the next version.
linux-kselftest-mirror@lists.linaro.org