forked from daos-stack/daos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-TSE_delete_running_complete_q_and_some_mutex.patch
100 lines (89 loc) · 3.13 KB
/
0001-TSE_delete_running_complete_q_and_some_mutex.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 489898ec0f2290b2e15785a9f4dec006de116e0d Mon Sep 17 00:00:00 2001
From: xb <[email protected]>
Date: Fri, 11 Aug 2023 10:31:33 +0800
Subject: [PATCH] =?UTF-8?q?TSE=E5=88=A0=E9=99=A4=E8=BF=90=E8=A1=8C?=
=?UTF-8?q?=E9=98=9F=E5=88=97,=E5=AE=8C=E6=88=90=E9=98=9F=E5=88=97?=
=?UTF-8?q?=E5=8F=8A=E9=83=A8=E5=88=86=E9=94=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/common/tse.c | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/common/tse.c b/src/common/tse.c
index 63854ff..65dcfe5 100644
--- a/src/common/tse.c
+++ b/src/common/tse.c
@@ -363,6 +363,8 @@ tse_sched_complete_cb(tse_sched_t *sched)
return 0;
}
+static void
+tse_sched_process_complete_task(struct tse_sched_private *dsp, struct tse_task_private *dtp);
/* Mark the tasks to complete */
static void
tse_task_complete_locked(struct tse_task_private *dtp,
@@ -382,7 +384,8 @@ tse_task_complete_locked(struct tse_task_private *dtp,
dtp->dtp_running = 0;
dtp->dtp_completed = 1;
- d_list_move_tail(&dtp->dtp_list, &dsp->dsp_complete_list);
+ // d_list_move_tail(&dtp->dtp_list, &dsp->dsp_complete_list);
+ tse_sched_process_complete_task(dsp, dtp);
}
static int
@@ -582,8 +585,8 @@ tse_sched_process_init(struct tse_sched_private *dsp)
tse_task_complete_locked(dtp, dsp);
} else {
dtp->dtp_running = 1;
- d_list_move_tail(&dtp->dtp_list,
- &dsp->dsp_running_list);
+ // d_list_move_tail(&dtp->dtp_list,
+ // &dsp->dsp_running_list);
/** +1 in case prep cb calls task_complete() */
tse_task_addref_locked(dtp);
bumped = true;
@@ -626,7 +629,7 @@ tse_task_post_process(tse_task_t *task)
tse_priv2sched(dsp)->ds_result = task->dt_result;
/* Check dependent list */
- D_MUTEX_LOCK(&dsp->dsp_lock);
+ // D_MUTEX_LOCK(&dsp->dsp_lock);
while (!d_list_empty(&dtp->dtp_dep_list)) {
struct tse_task_link *tlink;
tse_task_t *task_tmp;
@@ -698,7 +701,7 @@ tse_task_post_process(tse_task_t *task)
D_ASSERT(dsp->dsp_inflight > 0);
dsp->dsp_inflight--;
- D_MUTEX_UNLOCK(&dsp->dsp_lock);
+ // D_MUTEX_UNLOCK(&dsp->dsp_lock);
if (task->dt_result == 0)
task->dt_result = rc;
@@ -733,6 +736,21 @@ tse_sched_process_complete(struct tse_sched_private *dsp)
return processed;
}
+static void
+tse_sched_process_complete_task(struct tse_sched_private *dsp, struct tse_task_private *dtp)
+{
+
+ tse_task_t *task = tse_priv2task(dtp);
+
+ d_list_del_init(&dtp->dtp_list);
+ tse_task_post_process(task);
+ /* addref when the task add to dsp (tse_task_schedule) */
+ D_MUTEX_UNLOCK(&dsp->dsp_lock);
+ tse_sched_priv_decref(dsp);
+ tse_task_decref(task); /* drop final ref */
+ D_MUTEX_LOCK(&dsp->dsp_lock);
+}
+
bool
tse_sched_check_complete(tse_sched_t *sched)
{
@@ -1033,7 +1051,7 @@ tse_task_schedule_with_delay(tse_task_t *task, bool instant, uint64_t delay)
dsp->dsp_inflight++;
dtp->dtp_running = 1;
dtp->dtp_wakeup_time = 0;
- d_list_add_tail(&dtp->dtp_list, &dsp->dsp_running_list);
+ // d_list_add_tail(&dtp->dtp_list, &dsp->dsp_running_list);
/** +1 in case task is completed in body function */
if (instant)
--
1.8.3.1