Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
df64a297
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
df64a297
编写于
6月 10, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Kernel] Remove memory ops when SLAB and module enable
上级
564df04d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
10 addition
and
86 deletion
+10
-86
src/idle.c
src/idle.c
+2
-8
src/ipc.c
src/ipc.c
+4
-18
src/mempool.c
src/mempool.c
+2
-9
src/module.c
src/module.c
+0
-24
src/object.c
src/object.c
+2
-8
src/slab.c
src/slab.c
+0
-19
未找到文件。
src/idle.c
浏览文件 @
df64a297
...
...
@@ -164,14 +164,8 @@ void rt_thread_idle_excute(void)
rt_hw_interrupt_enable
(
lock
);
#ifdef RT_USING_HEAP
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
/* the thread belongs to an application module */
if
(
thread
->
flags
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
((
rt_module_t
)
thread
->
module_id
,
thread
->
stack_addr
);
else
#endif
/* release thread's stack */
RT_KERNEL_FREE
(
thread
->
stack_addr
);
/* release thread's stack */
RT_KERNEL_FREE
(
thread
->
stack_addr
);
/* delete thread object */
rt_object_delete
((
rt_object_t
)
thread
);
#endif
...
...
src/ipc.c
浏览文件 @
df64a297
...
...
@@ -1380,15 +1380,8 @@ rt_err_t rt_mb_delete(rt_mailbox_t mb)
/* also resume all mailbox private suspended thread */
rt_ipc_list_resume_all
(
&
(
mb
->
suspend_sender_thread
));
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
/* the mb object belongs to an application module */
if
(
mb
->
parent
.
parent
.
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
(
mb
->
parent
.
parent
.
module_id
,
mb
->
msg_pool
);
else
#endif
/* free mailbox pool */
RT_KERNEL_FREE
(
mb
->
msg_pool
);
/* free mailbox pool */
RT_KERNEL_FREE
(
mb
->
msg_pool
);
/* delete mailbox object */
rt_object_delete
(
&
(
mb
->
parent
.
parent
));
...
...
@@ -1900,15 +1893,8 @@ rt_err_t rt_mq_delete(rt_mq_t mq)
/* resume all suspended thread */
rt_ipc_list_resume_all
(
&
(
mq
->
parent
.
suspend_thread
));
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
/* the mq object belongs to an application module */
if
(
mq
->
parent
.
parent
.
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
(
mq
->
parent
.
parent
.
module_id
,
mq
->
msg_pool
);
else
#endif
/* free message queue pool */
RT_KERNEL_FREE
(
mq
->
msg_pool
);
/* free message queue pool */
RT_KERNEL_FREE
(
mq
->
msg_pool
);
/* delete message queue object */
rt_object_delete
(
&
(
mq
->
parent
.
parent
));
...
...
src/mempool.c
浏览文件 @
df64a297
...
...
@@ -292,15 +292,8 @@ rt_err_t rt_mp_delete(rt_mp_t mp)
rt_hw_interrupt_enable
(
temp
);
}
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
/* the mp object belongs to an application module */
if
(
mp
->
parent
.
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
(
mp
->
parent
.
module_id
,
mp
->
start_address
);
else
#endif
/* release allocated room */
rt_free
(
mp
->
start_address
);
/* release allocated room */
rt_free
(
mp
->
start_address
);
/* detach object */
rt_object_delete
(
&
(
mp
->
parent
));
...
...
src/module.c
浏览文件 @
df64a297
...
...
@@ -65,30 +65,6 @@
#define RT_USING_MODULE_PRIO (RT_THREAD_PRIORITY_MAX - 2)
#endif
#ifdef RT_USING_SLAB
#define PAGE_COUNT_MAX 256
/* module memory allocator */
struct
rt_mem_head
{
rt_size_t
size
;
/* size of memory block */
struct
rt_mem_head
*
next
;
/* next valid memory block */
};
struct
rt_page_info
{
rt_uint32_t
*
page_ptr
;
rt_uint32_t
npage
;
};
static
void
*
rt_module_malloc_page
(
rt_size_t
npages
);
static
void
rt_module_free_page
(
rt_module_t
module
,
void
*
page_ptr
,
rt_size_t
npages
);
static
struct
rt_semaphore
mod_sem
;
#endif
static
struct
rt_module_symtab
*
_rt_module_symtab_begin
=
RT_NULL
;
static
struct
rt_module_symtab
*
_rt_module_symtab_end
=
RT_NULL
;
...
...
src/object.c
浏览文件 @
df64a297
...
...
@@ -387,14 +387,8 @@ void rt_object_delete(rt_object_t object)
/* unlock interrupt */
rt_hw_interrupt_enable
(
temp
);
#if defined(RT_USING_MODULE) && defined(RT_USING_SLAB)
if
(
object
->
flag
&
RT_OBJECT_FLAG_MODULE
)
rt_module_free
((
rt_module_t
)
object
->
module_id
,
object
);
else
#endif
/* free the memory of object */
RT_KERNEL_FREE
(
object
);
/* free the memory of object */
RT_KERNEL_FREE
(
object
);
}
#endif
...
...
src/slab.c
浏览文件 @
df64a297
...
...
@@ -496,11 +496,6 @@ void *rt_malloc(rt_size_t size)
if
(
size
==
0
)
return
RT_NULL
;
#ifdef RT_USING_MODULE
if
(
rt_module_self
()
!=
RT_NULL
)
return
rt_module_malloc
(
size
);
#endif
/*
* Handle large allocations directly. There should not be very many of
* these so performance is not a big issue.
...
...
@@ -705,11 +700,6 @@ void *rt_realloc(void *ptr, rt_size_t size)
return
RT_NULL
;
}
#ifdef RT_USING_MODULE
if
(
rt_module_self
()
!=
RT_NULL
)
return
rt_module_realloc
(
ptr
,
size
);
#endif
/*
* Get the original allocation's zone. If the new request winds up
* using the same chunk size we do not have to do anything.
...
...
@@ -800,15 +790,6 @@ void rt_free(void *ptr)
RT_OBJECT_HOOK_CALL
(
rt_free_hook
,
(
ptr
));
#ifdef RT_USING_MODULE
if
(
rt_module_self
()
!=
RT_NULL
)
{
rt_module_free
(
rt_module_self
(),
ptr
);
return
;
}
#endif
/* get memory usage */
#if RT_DEBUG_SLAB
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录