Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Kernel Liteos A
提交
c360a97b
K
Kernel Liteos A
项目概览
OpenHarmony
/
Kernel Liteos A
大约 1 年 前同步成功
通知
454
Star
414
Fork
55
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel Liteos A
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c360a97b
编写于
10月 11, 2021
作者:
O
openharmony_ci
提交者:
Gitee
10月 11, 2021
浏览文件
操作
浏览文件
下载
差异文件
!631 fix: 进程在退出前回收vmspace中的所有Region
Merge pull request !631 from zhushengle/process
上级
56a92f92
298ccea3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
19 deletion
+50
-19
kernel/base/core/los_process.c
kernel/base/core/los_process.c
+8
-2
kernel/base/include/los_vm_map.h
kernel/base/include/los_vm_map.h
+2
-0
kernel/base/vm/los_vm_map.c
kernel/base/vm/los_vm_map.c
+40
-17
未找到文件。
kernel/base/core/los_process.c
浏览文件 @
c360a97b
...
@@ -342,6 +342,12 @@ LITE_OS_SEC_TEXT VOID OsProcessResourcesToFree(LosProcessCB *processCB)
...
@@ -342,6 +342,12 @@ LITE_OS_SEC_TEXT VOID OsProcessResourcesToFree(LosProcessCB *processCB)
OsCurrProcessGet
()
->
processID
,
processCB
->
processID
);
OsCurrProcessGet
()
->
processID
,
processCB
->
processID
);
}
}
#ifdef LOSCFG_KERNEL_VM
if
(
OsProcessIsUserMode
(
processCB
))
{
(
VOID
)
OsVmSpaceRegionFree
(
processCB
->
vmSpace
);
}
#endif
#ifdef LOSCFG_FS_VFS
#ifdef LOSCFG_FS_VFS
if
(
OsProcessIsUserMode
(
processCB
))
{
if
(
OsProcessIsUserMode
(
processCB
))
{
delete_files
(
processCB
->
files
);
delete_files
(
processCB
->
files
);
...
@@ -546,11 +552,11 @@ LITE_OS_SEC_TEXT VOID OsProcessCBRecycleToFree(VOID)
...
@@ -546,11 +552,11 @@ LITE_OS_SEC_TEXT VOID OsProcessCBRecycleToFree(VOID)
/* Clear the bottom 4 bits of process status */
/* Clear the bottom 4 bits of process status */
OsInsertPCBToFreeList
(
processCB
);
OsInsertPCBToFreeList
(
processCB
);
}
}
SCHEDULER_UNLOCK
(
intSave
);
#ifdef LOSCFG_KERNEL_VM
#ifdef LOSCFG_KERNEL_VM
SCHEDULER_UNLOCK
(
intSave
);
(
VOID
)
LOS_VmSpaceFree
(
space
);
(
VOID
)
LOS_VmSpaceFree
(
space
);
#endif
SCHEDULER_LOCK
(
intSave
);
SCHEDULER_LOCK
(
intSave
);
#endif
}
}
SCHEDULER_UNLOCK
(
intSave
);
SCHEDULER_UNLOCK
(
intSave
);
...
...
kernel/base/include/los_vm_map.h
浏览文件 @
c360a97b
...
@@ -292,6 +292,8 @@ LosVmSpace *OsCreateUserVmSpace(VOID);
...
@@ -292,6 +292,8 @@ LosVmSpace *OsCreateUserVmSpace(VOID);
STATUS_T
LOS_VmSpaceClone
(
LosVmSpace
*
oldVmSpace
,
LosVmSpace
*
newVmSpace
);
STATUS_T
LOS_VmSpaceClone
(
LosVmSpace
*
oldVmSpace
,
LosVmSpace
*
newVmSpace
);
LosMux
*
OsGVmSpaceMuxGet
(
VOID
);
LosMux
*
OsGVmSpaceMuxGet
(
VOID
);
STATUS_T
OsUnMMap
(
LosVmSpace
*
space
,
VADDR_T
addr
,
size_t
size
);
STATUS_T
OsUnMMap
(
LosVmSpace
*
space
,
VADDR_T
addr
,
size_t
size
);
STATUS_T
OsVmSpaceRegionFree
(
LosVmSpace
*
space
);
/**
/**
* thread safety
* thread safety
* it is used to malloc continuous virtual memory, no sure for continuous physical memory.
* it is used to malloc continuous virtual memory, no sure for continuous physical memory.
...
...
kernel/base/vm/los_vm_map.c
浏览文件 @
c360a97b
...
@@ -844,13 +844,47 @@ ERR_REGION_SPLIT:
...
@@ -844,13 +844,47 @@ ERR_REGION_SPLIT:
return
status
;
return
status
;
}
}
STAT
US_T
LOS_VmSpace
Free
(
LosVmSpace
*
space
)
STAT
IC
VOID
OsVmSpaceAllRegion
Free
(
LosVmSpace
*
space
)
{
{
LosVmMapRegion
*
region
=
NULL
;
LosRbNode
*
pstRbNode
=
NULL
;
LosRbNode
*
pstRbNode
=
NULL
;
LosRbNode
*
pstRbNodeNext
=
NULL
;
LosRbNode
*
pstRbNodeNext
=
NULL
;
STATUS_T
ret
;
/* free all of the regions */
RB_SCAN_SAFE
(
&
space
->
regionRbTree
,
pstRbNode
,
pstRbNodeNext
)
LosVmMapRegion
*
region
=
(
LosVmMapRegion
*
)
pstRbNode
;
if
(
region
->
range
.
size
==
0
)
{
VM_ERR
(
"space free, region: %#x flags: %#x, base:%#x, size: %#x"
,
region
,
region
->
regionFlags
,
region
->
range
.
base
,
region
->
range
.
size
);
}
STATUS_T
ret
=
LOS_RegionFree
(
space
,
region
);
if
(
ret
!=
LOS_OK
)
{
VM_ERR
(
"free region error, space %p, region %p"
,
space
,
region
);
}
RB_SCAN_SAFE_END
(
&
space
->
regionRbTree
,
pstRbNode
,
pstRbNodeNext
)
return
;
}
STATUS_T
OsVmSpaceRegionFree
(
LosVmSpace
*
space
)
{
if
(
space
==
NULL
)
{
return
LOS_ERRNO_VM_INVALID_ARGS
;
}
if
(
space
==
&
g_kVmSpace
)
{
VM_ERR
(
"try to free kernel aspace, not allowed"
);
return
LOS_OK
;
}
(
VOID
)
LOS_MuxAcquire
(
&
space
->
regionMux
);
OsVmSpaceAllRegionFree
(
space
);
(
VOID
)
LOS_MuxRelease
(
&
space
->
regionMux
);
return
LOS_OK
;
}
STATUS_T
LOS_VmSpaceFree
(
LosVmSpace
*
space
)
{
if
(
space
==
NULL
)
{
if
(
space
==
NULL
)
{
return
LOS_ERRNO_VM_INVALID_ARGS
;
return
LOS_ERRNO_VM_INVALID_ARGS
;
}
}
...
@@ -862,19 +896,10 @@ STATUS_T LOS_VmSpaceFree(LosVmSpace *space)
...
@@ -862,19 +896,10 @@ STATUS_T LOS_VmSpaceFree(LosVmSpace *space)
/* pop it out of the global aspace list */
/* pop it out of the global aspace list */
(
VOID
)
LOS_MuxAcquire
(
&
space
->
regionMux
);
(
VOID
)
LOS_MuxAcquire
(
&
space
->
regionMux
);
LOS_ListDelete
(
&
space
->
node
);
LOS_ListDelete
(
&
space
->
node
);
/* free all of the regions */
RB_SCAN_SAFE
(
&
space
->
regionRbTree
,
pstRbNode
,
pstRbNodeNext
)
OsVmSpaceAllRegionFree
(
space
);
region
=
(
LosVmMapRegion
*
)
pstRbNode
;
if
(
region
->
range
.
size
==
0
)
{
VM_ERR
(
"space free, region: %#x flags: %#x, base:%#x, size: %#x"
,
region
,
region
->
regionFlags
,
region
->
range
.
base
,
region
->
range
.
size
);
}
ret
=
LOS_RegionFree
(
space
,
region
);
if
(
ret
!=
LOS_OK
)
{
VM_ERR
(
"free region error, space %p, region %p"
,
space
,
region
);
}
RB_SCAN_SAFE_END
(
&
space
->
regionRbTree
,
pstRbNode
,
pstRbNodeNext
)
/* make sure the current thread does not map the aspace */
/* make sure the current thread does not map the aspace */
LosProcessCB
*
currentProcess
=
OsCurrProcessGet
();
LosProcessCB
*
currentProcess
=
OsCurrProcessGet
();
...
@@ -1185,5 +1210,3 @@ VOID LOS_KernelFree(VOID *ptr)
...
@@ -1185,5 +1210,3 @@ VOID LOS_KernelFree(VOID *ptr)
(
VOID
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
ptr
);
(
VOID
)
LOS_MemFree
(
OS_SYS_MEM_ADDR
,
ptr
);
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录