* [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
@ 2022-04-06 17:57 Athira Rajeev
2022-04-06 20:05 ` Shuah Khan
0 siblings, 1 reply; 3+ messages in thread
From: Athira Rajeev @ 2022-04-06 17:57 UTC (permalink / raw)
To: shuah, linux-kselftest, disgoel
Cc: maddy, srikar, linux-kernel, acme, linux-perf-users, jolsa, kjain,
linuxppc-dev
The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate
CPU set. This cpu set is used further in pthread_attr_setaffinity_np
and by pthread_create in the code. But in current code, allocated
cpu set is not freed. Fix this by adding CPU_FREE after its usage
is done.
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/testing/selftests/mqueue/mq_perf_tests.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
index b019e0b8221c..17c41f216bef 100644
--- a/tools/testing/selftests/mqueue/mq_perf_tests.c
+++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
@@ -732,6 +732,7 @@ int main(int argc, char *argv[])
pthread_attr_destroy(&thread_attr);
}
+ CPU_FREE(cpu_set);
if (!continuous_mode) {
pthread_join(cpu_threads[0], &retval);
shutdown((long)retval, "perf_test_thread()", __LINE__);
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
2022-04-06 17:57 [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set Athira Rajeev
@ 2022-04-06 20:05 ` Shuah Khan
2022-04-07 4:30 ` Athira Rajeev
0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2022-04-06 20:05 UTC (permalink / raw)
To: Athira Rajeev, shuah, linux-kselftest, disgoel
Cc: maddy, srikar, Shuah Khan, linux-kernel, acme, linux-perf-users,
jolsa, kjain, linuxppc-dev
On 4/6/22 11:57 AM, Athira Rajeev wrote:
> The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate
> CPU set. This cpu set is used further in pthread_attr_setaffinity_np
> and by pthread_create in the code. But in current code, allocated
> cpu set is not freed. Fix this by adding CPU_FREE after its usage
> is done.
>
Good find.
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> tools/testing/selftests/mqueue/mq_perf_tests.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
> index b019e0b8221c..17c41f216bef 100644
> --- a/tools/testing/selftests/mqueue/mq_perf_tests.c
> +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
> @@ -732,6 +732,7 @@ int main(int argc, char *argv[])
> pthread_attr_destroy(&thread_attr);
> }
>
> + CPU_FREE(cpu_set);
> if (!continuous_mode) {
> pthread_join(cpu_threads[0], &retval);
> shutdown((long)retval, "perf_test_thread()", __LINE__);
>
CPU_ALLOC() is called very early on in main() and there are a
few error paths that exit without calling CPU_FREE. This change
doesn't fully fix the problem.
Review the other exit paths where CPU_FREE is needed.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set
2022-04-06 20:05 ` Shuah Khan
@ 2022-04-07 4:30 ` Athira Rajeev
0 siblings, 0 replies; 3+ messages in thread
From: Athira Rajeev @ 2022-04-07 4:30 UTC (permalink / raw)
To: Shuah Khan
Cc: maddy, linux-kselftest, linuxppc-dev, Arnaldo Carvalho de Melo,
Linux Kernel Mailing List, linux-perf-users, Jiri Olsa, kajoljain,
disgoel, shuah, srikar
> On 07-Apr-2022, at 1:35 AM, Shuah Khan <skhan@linuxfoundation.org> wrote:
>
> On 4/6/22 11:57 AM, Athira Rajeev wrote:
>> The selftest "mqueue/mq_perf_tests.c" use CPU_ALLOC to allocate
>> CPU set. This cpu set is used further in pthread_attr_setaffinity_np
>> and by pthread_create in the code. But in current code, allocated
>> cpu set is not freed. Fix this by adding CPU_FREE after its usage
>> is done.
>
> Good find.
>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>> ---
>> tools/testing/selftests/mqueue/mq_perf_tests.c | 1 +
>> 1 file changed, 1 insertion(+)
>> diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c
>> index b019e0b8221c..17c41f216bef 100644
>> --- a/tools/testing/selftests/mqueue/mq_perf_tests.c
>> +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c
>> @@ -732,6 +732,7 @@ int main(int argc, char *argv[])
>> pthread_attr_destroy(&thread_attr);
>> }
>> + CPU_FREE(cpu_set);
>> if (!continuous_mode) {
>> pthread_join(cpu_threads[0], &retval);
>> shutdown((long)retval, "perf_test_thread()", __LINE__);
>
> CPU_ALLOC() is called very early on in main() and there are a
> few error paths that exit without calling CPU_FREE. This change
> doesn't fully fix the problem.
>
> Review the other exit paths where CPU_FREE is needed.
Sure, Thanks for the review.
I will check and post a V2
thanks
Athira
>
> thanks,
> -- Shuah
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-07 4:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-06 17:57 [PATCH] testing/selftests/mqueue: Fix mq_perf_tests to free the allocated cpu set Athira Rajeev
2022-04-06 20:05 ` Shuah Khan
2022-04-07 4:30 ` Athira Rajeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).