Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'linux-kselftest-fixes-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kselftest fixes from Shuah Khan:
"A mqueue perf test memory leak bug fix.

mq_perf_tests failed to call CPU_FREE to free memory allocated by
CPU_SET"

* tag 'linux-kselftest-fixes-5.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set

+17 -8
+17 -8
tools/testing/selftests/mqueue/mq_perf_tests.c
··· 180 180 if (in_shutdown++) 181 181 return; 182 182 183 + /* Free the cpu_set allocated using CPU_ALLOC in main function */ 184 + CPU_FREE(cpu_set); 185 + 183 186 for (i = 0; i < num_cpus_to_pin; i++) 184 187 if (cpu_threads[i]) { 185 188 pthread_kill(cpu_threads[i], SIGUSR1); ··· 554 551 perror("sysconf(_SC_NPROCESSORS_ONLN)"); 555 552 exit(1); 556 553 } 554 + 555 + if (getuid() != 0) 556 + ksft_exit_skip("Not running as root, but almost all tests " 557 + "require root in order to modify\nsystem settings. " 558 + "Exiting.\n"); 559 + 557 560 cpus_online = min(MAX_CPUS, sysconf(_SC_NPROCESSORS_ONLN)); 558 561 cpu_set = CPU_ALLOC(cpus_online); 559 562 if (cpu_set == NULL) { ··· 598 589 cpu_set)) { 599 590 fprintf(stderr, "Any given CPU may " 600 591 "only be given once.\n"); 601 - exit(1); 592 + goto err_code; 602 593 } else 603 594 CPU_SET_S(cpus_to_pin[cpu], 604 595 cpu_set_size, cpu_set); ··· 616 607 queue_path = malloc(strlen(option) + 2); 617 608 if (!queue_path) { 618 609 perror("malloc()"); 619 - exit(1); 610 + goto err_code; 620 611 } 621 612 queue_path[0] = '/'; 622 613 queue_path[1] = 0; ··· 631 622 fprintf(stderr, "Must pass at least one CPU to continuous " 632 623 "mode.\n"); 633 624 poptPrintUsage(popt_context, stderr, 0); 634 - exit(1); 625 + goto err_code; 635 626 } else if (!continuous_mode) { 636 627 num_cpus_to_pin = 1; 637 628 cpus_to_pin[0] = cpus_online - 1; 638 629 } 639 - 640 - if (getuid() != 0) 641 - ksft_exit_skip("Not running as root, but almost all tests " 642 - "require root in order to modify\nsystem settings. " 643 - "Exiting.\n"); 644 630 645 631 max_msgs = fopen(MAX_MSGS, "r+"); 646 632 max_msgsize = fopen(MAX_MSGSIZE, "r+"); ··· 744 740 sleep(1); 745 741 } 746 742 shutdown(0, "", 0); 743 + 744 + err_code: 745 + CPU_FREE(cpu_set); 746 + exit(1); 747 + 747 748 }