diff mbox series

[v4,24/24] dept: Disable Dept on that map once it's been handled until next turn

Message ID 1646377603-19730-25-git-send-email-byungchul.park@lge.com (mailing list archive)
State New, archived
Headers show
Series DEPT(Dependency Tracker) | expand

Commit Message

Byungchul Park March 4, 2022, 7:06 a.m. UTC
Dept works with waits preceeding an event, that might lead a deadlock.
Once the event has been handled, it's hard to ensure further waits
actually contibute to deadlock until next turn, which will start when
a sleep associated with that map happens.

So let Dept start tracking dependency when a sleep happens and stop
tracking dependency once the event e.i. wake up, has been handled.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/dependency/dept.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c
index cc1b3a3..1c91db8 100644
--- a/kernel/dependency/dept.c
+++ b/kernel/dependency/dept.c
@@ -2325,6 +2325,12 @@  void dept_event(struct dept_map *m, unsigned long e_f, unsigned long ip,
 		do_event((void *)m, c, READ_ONCE(m->wgen), ip);
 		pop_ecxt((void *)m);
 	}
+
+	/*
+	 * Keep the map diabled until the next sleep.
+	 */
+	WRITE_ONCE(m->wgen, 0);
+
 	dept_exit(flags);
 }
 EXPORT_SYMBOL_GPL(dept_event);
@@ -2447,6 +2453,11 @@  void dept_event_split_map(struct dept_map_each *me,
 		pop_ecxt((void *)me);
 	}
 
+	/*
+	 * Keep the map diabled until the next sleep.
+	 */
+	WRITE_ONCE(me->wgen, 0);
+
 	dept_exit(flags);
 }
 EXPORT_SYMBOL_GPL(dept_event_split_map);