mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
sched: use this_task replace nxsched_self
reason: We can reduce a function call to improve performance. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
+2
-1
@@ -19,4 +19,5 @@
|
||||
# ##############################################################################
|
||||
nuttx_add_kernel_library(mm SPLIT)
|
||||
nuttx_add_subdirectory()
|
||||
target_include_directories(mm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_include_directories(mm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${NUTTX_DIR}/sched)
|
||||
|
||||
@@ -53,6 +53,7 @@ else
|
||||
endif
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)mm
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)sched
|
||||
|
||||
AOBJS = $(patsubst %.S, $(BINDIR)$(DELIMS)%$(OBJEXT), $(ASRCS))
|
||||
COBJS = $(patsubst %.c, $(BINDIR)$(DELIMS)%$(OBJEXT), $(CSRCS))
|
||||
|
||||
+4
-2
@@ -38,6 +38,8 @@
|
||||
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_KERNEL)
|
||||
|
||||
/****************************************************************************
|
||||
@@ -74,7 +76,7 @@ static struct mm_map_s g_kmm_map;
|
||||
|
||||
static int get_user_pages(FAR void **pages, size_t npages, uintptr_t vaddr)
|
||||
{
|
||||
FAR struct tcb_s *tcb = nxsched_self();
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
uintptr_t page;
|
||||
int i;
|
||||
|
||||
@@ -177,7 +179,7 @@ errout_with_vaddr:
|
||||
|
||||
static FAR void *map_single_user_page(uintptr_t vaddr)
|
||||
{
|
||||
FAR struct tcb_s *tcb = nxsched_self();
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
uintptr_t page;
|
||||
|
||||
/* Find the page associated with this virtual address */
|
||||
|
||||
+4
-2
@@ -32,6 +32,8 @@
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
#if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__)
|
||||
|
||||
/****************************************************************************
|
||||
@@ -64,7 +66,7 @@ static bool in_range(FAR const void *start, size_t length,
|
||||
|
||||
int mm_map_lock(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = nxsched_self();
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
|
||||
if (group == NULL)
|
||||
@@ -85,7 +87,7 @@ int mm_map_lock(void)
|
||||
|
||||
void mm_map_unlock(void)
|
||||
{
|
||||
FAR struct tcb_s *tcb = nxsched_self();
|
||||
FAR struct tcb_s *tcb = this_task();
|
||||
FAR struct task_group_s *group = tcb->group;
|
||||
|
||||
if (group == NULL)
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@
|
||||
#include <nuttx/pgalloc.h>
|
||||
#include <nuttx/mm/map.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "shm/shm.h"
|
||||
|
||||
#ifdef CONFIG_MM_SHM
|
||||
@@ -222,7 +223,7 @@ FAR void *shmat(int shmid, FAR const void *shmaddr, int shmflg)
|
||||
|
||||
/* Get the TCB and group containing our virtual memory allocator */
|
||||
|
||||
tcb = nxsched_self();
|
||||
tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
|
||||
group = tcb->group;
|
||||
|
||||
+2
-1
@@ -34,6 +34,7 @@
|
||||
#include <nuttx/pgalloc.h>
|
||||
#include <nuttx/mm/map.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "shm/shm.h"
|
||||
|
||||
#ifdef CONFIG_MM_SHM
|
||||
@@ -72,7 +73,7 @@ int shmdt(FAR const void *shmaddr)
|
||||
|
||||
/* Get the TCB and group containing our virtual memory allocator */
|
||||
|
||||
tcb = nxsched_self();
|
||||
tcb = this_task();
|
||||
DEBUGASSERT(tcb && tcb->group);
|
||||
group = tcb->group;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user