Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party FreeBSD
提交
0b4d6a85
T
Third Party FreeBSD
项目概览
OpenHarmony
/
Third Party FreeBSD
1 年多 前同步成功
通知
3
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party FreeBSD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0b4d6a85
编写于
1月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!41 feat: 优化调度结构
Merge pull request !41 from zhushengle/optimize_sched
上级
f152d4bd
5e583ec1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
13 addition
and
56 deletion
+13
-56
sys/compat/linuxkpi/common/src/linux_workqueue.c
sys/compat/linuxkpi/common/src/linux_workqueue.c
+13
-56
未找到文件。
sys/compat/linuxkpi/common/src/linux_workqueue.c
浏览文件 @
0b4d6a85
...
...
@@ -47,7 +47,6 @@ STATIC UINT32 CreateWorkqueueThread(cpu_workqueue_struct *cwq, INT32 cpu);
STATIC
VOID
WorkerThread
(
cpu_workqueue_struct
*
cwq
);
STATIC
VOID
RunWorkqueue
(
cpu_workqueue_struct
*
cwq
);
STATIC
VOID
DelayedWorkTimerFunc
(
unsigned
long
data
);
typedef
BOOL
(
*
OsSortLinkCond
)(
SWTMR_CTRL_S
*
swtmr
,
struct
delayed_work
*
dwork
);
/*
* @ingroup workqueue
...
...
@@ -357,49 +356,15 @@ STATIC VOID DelayedWorkTimerFunc(unsigned long data)
LOS_SpinUnlockRestore
(
&
g_workqueueSpin
,
intSave
);
}
STATIC
BOOL
Os
PerCpuSortLinkSearch
(
SortLinkAttribute
*
swtmrSortLink
,
OsSortLinkCond
checkFunc
,
VOID
*
arg
)
STATIC
BOOL
Os
DelayWorkQueueCond
(
UINTPTR
sortList
,
UINTPTR
dwork
)
{
LOS_DL_LIST
*
listObject
=
&
swtmrSortLink
->
sortLink
;
LOS_DL_LIST
*
list
=
listObject
->
pstNext
;
while
(
list
!=
listObject
)
{
SortLinkList
*
listSorted
=
LOS_DL_LIST_ENTRY
(
list
,
SortLinkList
,
sortLinkNode
);
SWTMR_CTRL_S
*
curSwtmr
=
LOS_DL_LIST_ENTRY
(
listSorted
,
SWTMR_CTRL_S
,
stSortList
);
if
(
checkFunc
(
curSwtmr
,
arg
))
{
return
TRUE
;
}
list
=
list
->
pstNext
;
}
return
FALSE
;
}
BOOL
OsSortLinkSearch
(
OsSortLinkCond
checkFunc
,
VOID
*
arg
)
{
UINT32
intSave
;
UINT32
i
;
for
(
i
=
0
;
i
<
LOSCFG_KERNEL_CORE_NUM
;
i
++
)
{
Percpu
*
cpu
=
OsPercpuGetByID
(
i
);
SortLinkAttribute
*
swtmrSortLink
=
&
OsPercpuGetByID
(
i
)
->
swtmrSortLink
;
LOS_SpinLockSave
(
&
cpu
->
swtmrSortLinkSpin
,
&
intSave
);
if
(
OsPerCpuSortLinkSearch
(
swtmrSortLink
,
checkFunc
,
arg
))
{
LOS_SpinUnlockRestore
(
&
cpu
->
swtmrSortLinkSpin
,
intSave
);
return
TRUE
;
}
LOS_SpinUnlockRestore
(
&
cpu
->
swtmrSortLinkSpin
,
intSave
);
}
return
FALSE
;
}
STATIC
BOOL
OsDelayWorkQueueCond
(
SWTMR_CTRL_S
*
swtmr
,
struct
delayed_work
*
dwork
)
{
return
(((
struct
delayed_work
*
)
swtmr
->
uwArg
)
==
dwork
);
SWTMR_CTRL_S
*
swtmr
=
LOS_DL_LIST_ENTRY
(
sortList
,
SWTMR_CTRL_S
,
stSortList
);
return
(((
struct
delayed_work
*
)
swtmr
->
uwArg
)
==
(
struct
delayed_work
*
)
dwork
);
}
bool
queue_delayed_work
(
struct
workqueue_struct
*
wq
,
struct
delayed_work
*
dwork
,
unsigned
int
delayTime
)
{
UINT32
intSave
,
intSave1
;
UINT32
intSave
;
struct
work_struct
*
work
=
NULL
;
if
((
wq
==
NULL
)
||
(
wq
->
name
==
NULL
)
||
(
wq
->
cpu_wq
==
NULL
)
||
(
dwork
==
NULL
))
{
...
...
@@ -412,13 +377,11 @@ bool queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
}
LOS_SpinLockSave
(
&
g_workqueueSpin
,
&
intSave
);
LOS_SpinLockSave
(
&
g_swtmrSpin
,
&
intSave1
);
if
(
OsSortLinkSearch
(
OsDelayWorkQueueCond
,
dwork
))
{
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
if
(
OsSwtmrWorkQueueFind
(
OsDelayWorkQueueCond
,
(
UINTPTR
)
dwork
))
{
LOS_SpinUnlockRestore
(
&
g_workqueueSpin
,
intSave
);
return
FALSE
;
}
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
if
(
!
WorkqueueIsEmpty
(
wq
->
cpu_wq
))
{
LIST_FOR_WORK
(
work
,
&
wq
->
cpu_wq
->
worklist
,
struct
work_struct
,
entry
)
{
if
(
work
==
&
dwork
->
work
)
{
...
...
@@ -436,9 +399,10 @@ bool queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
}
STATIC
BOOL
OsDelayWorkCancelCond
(
SWTMR_CTRL_S
*
swtmr
,
struct
delayed_work
*
dwork
)
STATIC
BOOL
OsDelayWorkCancelCond
(
UINTPTR
sortList
,
UINTPTR
dwork
)
{
if
((
swtmr
->
usTimerID
==
dwork
->
timer
.
timerid
)
&&
SWTMR_CTRL_S
*
swtmr
=
LOS_DL_LIST_ENTRY
(
sortList
,
SWTMR_CTRL_S
,
stSortList
);
if
((
swtmr
->
usTimerID
==
((
struct
delayed_work
*
)
dwork
)
->
timer
.
timerid
)
&&
(
swtmr
->
ucState
==
OS_SWTMR_STATUS_TICKING
))
{
return
TRUE
;
}
...
...
@@ -449,7 +413,7 @@ bool linux_cancel_delayed_work(struct delayed_work *dwork)
{
struct
work_struct
*
work
=
NULL
;
struct
work_struct
*
workNext
=
NULL
;
UINT32
intSave
,
intSave1
;
UINT32
intSave
;
bool
ret
=
FALSE
;
if
((
dwork
==
NULL
)
||
(
dwork
->
wq
==
NULL
))
{
...
...
@@ -459,9 +423,7 @@ bool linux_cancel_delayed_work(struct delayed_work *dwork)
LOS_SpinLockSave
(
&
g_workqueueSpin
,
&
intSave
);
if
(
dwork
->
work
.
work_status
&
WORK_STRUCT_PENDING
)
{
LOS_SpinLockSave
(
&
g_swtmrSpin
,
&
intSave1
);
if
(
OsSortLinkSearch
(
OsDelayWorkCancelCond
,
dwork
))
{
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
if
(
OsSwtmrWorkQueueFind
(
OsDelayWorkCancelCond
,
(
UINTPTR
)
dwork
))
{
(
VOID
)
del_timer
(
&
dwork
->
timer
);
dwork
->
work
.
work_status
=
0
;
dwork
->
wq
->
delayed_work_count
--
;
...
...
@@ -469,7 +431,6 @@ bool linux_cancel_delayed_work(struct delayed_work *dwork)
return
TRUE
;
}
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
if
(
dwork
->
work
.
work_status
&
WORK_STRUCT_RUNNING
)
{
ret
=
FALSE
;
}
else
if
(
dwork
->
work
.
work_status
&
WORK_STRUCT_PENDING
)
{
...
...
@@ -495,7 +456,7 @@ bool linux_cancel_delayed_work_sync(struct delayed_work *dwork)
bool
linux_flush_delayed_work
(
struct
delayed_work
*
dwork
)
{
UINT32
intSave
,
intSave1
;
UINT32
intSave
;
if
((
dwork
==
NULL
)
||
(
dwork
->
wq
==
NULL
))
{
return
FALSE
;
...
...
@@ -507,15 +468,11 @@ bool linux_flush_delayed_work(struct delayed_work *dwork)
return
FALSE
;
}
LOS_SpinLockSave
(
&
g_swtmrSpin
,
&
intSave1
);
if
(
OsSortLinkSearch
(
OsDelayWorkCancelCond
,
dwork
))
{
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
if
(
OsSwtmrWorkQueueFind
(
OsDelayWorkCancelCond
,
(
UINTPTR
)
dwork
))
{
(
VOID
)
del_timer
(
&
dwork
->
timer
);
dwork
->
wq
->
delayed_work_count
--
;
LOS_SpinUnlockRestore
(
&
g_workqueueSpin
,
intSave
);
(
VOID
)
queue_work
(
dwork
->
wq
,
&
dwork
->
work
);
}
else
{
LOS_SpinUnlockRestore
(
&
g_swtmrSpin
,
intSave1
);
LOS_SpinUnlockRestore
(
&
g_workqueueSpin
,
intSave
);
}
(
VOID
)
flush_work
(
&
dwork
->
work
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录