mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: reduce the ccm for thread unit
Reduce the code complexity of function nvgpu_thread_create_priority in Thread unit. Jira NVGPU-4987 Change-Id: I85da527c3d8dbbe37c5428e5bded9ed19b299613 Signed-off-by: ajesh <akv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2327865 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -221,36 +221,24 @@ int nvgpu_thread_create_priority(struct nvgpu_thread *thread,
|
||||
|
||||
ret = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
|
||||
if (ret != 0) {
|
||||
if ((pthread_attr_destroy(&attr)) != 0) {
|
||||
nvgpu_info(NULL, "Thread attr destroy error");
|
||||
}
|
||||
return ret;
|
||||
goto attr_destroy;
|
||||
}
|
||||
|
||||
ret = pthread_attr_setschedpolicy(&attr, SCHED_RR);
|
||||
if (ret != 0) {
|
||||
if ((pthread_attr_destroy(&attr)) != 0) {
|
||||
nvgpu_info(NULL, "Thread attr destroy error");
|
||||
}
|
||||
return ret;
|
||||
goto attr_destroy;
|
||||
}
|
||||
|
||||
param.sched_priority = priority;
|
||||
ret = pthread_attr_setschedparam(&attr, ¶m);
|
||||
if (ret != 0) {
|
||||
if ((pthread_attr_destroy(&attr)) != 0) {
|
||||
nvgpu_info(NULL, "Thread attr destroy error");
|
||||
}
|
||||
return ret;
|
||||
goto attr_destroy;
|
||||
}
|
||||
|
||||
ret = pthread_create(&thread->thread, &attr,
|
||||
nvgpu_posix_thread_wrapper, &thread->nvgpu);
|
||||
if (ret != 0) {
|
||||
if ((pthread_attr_destroy(&attr)) != 0) {
|
||||
nvgpu_info(NULL, "Thread attr destroy error");
|
||||
}
|
||||
return ret;
|
||||
goto attr_destroy;
|
||||
}
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
@@ -283,6 +271,13 @@ int nvgpu_thread_create_priority(struct nvgpu_thread *thread,
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
attr_destroy:
|
||||
if ((pthread_attr_destroy(&attr)) != 0) {
|
||||
nvgpu_info(NULL, "Thread attr destroy error");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void nvgpu_thread_stop(struct nvgpu_thread *thread)
|
||||
|
||||
Reference in New Issue
Block a user