sched/tls: inline group info in flat mode to improve performance

inline group info in flat mode to improve the task create/destroy performance

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-02-26 18:46:20 +08:00 committed by Xiang Xiao
parent 9d5471349f
commit 954bffcbd7
6 changed files with 20 additions and 3 deletions

View File

@ -45,6 +45,7 @@
#include <nuttx/fs/fs.h>
#include <nuttx/net/net.h>
#include <nuttx/mm/map.h>
#include <nuttx/tls.h>
#include <arch/arch.h>
@ -401,8 +402,6 @@ struct stackinfo_s
* the struct task_group_s is free.
*/
struct task_info_s;
#ifndef CONFIG_DISABLE_PTHREAD
struct join_s; /* Forward reference */
/* Defined in sched/pthread/pthread.h */
@ -480,6 +479,9 @@ struct task_group_s
/* Thread local storage ***************************************************/
#ifndef CONFIG_MM_KERNEL_HEAP
struct task_info_s tg_info_;
#endif
FAR struct task_info_s *tg_info;
/* POSIX Signal Control Fields ********************************************/

View File

@ -27,7 +27,14 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
#include <stdint.h>
#include <stdbool.h>
#include <arch/arch.h>
#include <arch/types.h>
#include <nuttx/compiler.h>
#include <nuttx/cache.h>
#include <nuttx/atexit.h>
#include <nuttx/fs/fs.h>
#include <nuttx/list.h>

View File

@ -28,6 +28,7 @@
#include <assert.h>
#include <nuttx/tls.h>
#include <nuttx/sched.h>
#if !defined(up_tls_info) && (defined(__KERNEL__) || !defined(CONFIG_TLS_ALIGNED))

View File

@ -119,11 +119,15 @@ int task_init_info(FAR struct task_group_s *group)
/* Allocate task info for group */
#ifdef CONFIG_MM_KERNEL_HEAP
info = group_zalloc(group, sizeof(struct task_info_s));
if (info == NULL)
{
return -ENOMEM;
}
#else
info = &group->tg_info_;
#endif
/* Initialize user space mutex */

View File

@ -142,5 +142,7 @@ void task_uninit_info(FAR struct task_group_s *group)
#endif /* CONFIG_FILE_STREAM */
nxmutex_destroy(&info->ta_lock);
#ifdef CONFIG_MM_KERNEL_HEAP
group_free(group, info);
#endif
}

View File

@ -25,6 +25,7 @@
* Included Files
****************************************************************************/
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include <nuttx/tls.h>