lkml.org 
[lkml]   [2023]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH RFC v7 18/23] dept: Apply timeout consideration to wait_for_completion()/complete()
Date
Now that CONFIG_DEPT_AGGRESSIVE_TIMEOUT_WAIT was introduced, apply the
consideration to wait_for_completion()/complete().

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
include/linux/completion.h | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/linux/completion.h b/include/linux/completion.h
index 0408f6d..57a715f 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -11,6 +11,7 @@

#include <linux/swait.h>
#include <linux/dept_sdt.h>
+#include <linux/sched.h>

/*
* struct completion - structure used to maintain state for a "completion"
@@ -153,7 +154,10 @@ extern long raw_wait_for_completion_killable_timeout(
#define wait_for_completion_timeout(x, t) \
({ \
unsigned long __ret; \
- sdt_might_sleep_strong(NULL); \
+ if ((t) == MAX_SCHEDULE_TIMEOUT) \
+ sdt_might_sleep_strong(NULL); \
+ else \
+ sdt_might_sleep_strong_timeout(NULL); \
__ret = raw_wait_for_completion_timeout(x, t); \
sdt_might_sleep_finish(); \
__ret; \
@@ -161,7 +165,10 @@ extern long raw_wait_for_completion_killable_timeout(
#define wait_for_completion_io_timeout(x, t) \
({ \
unsigned long __ret; \
- sdt_might_sleep_strong(NULL); \
+ if ((t) == MAX_SCHEDULE_TIMEOUT) \
+ sdt_might_sleep_strong(NULL); \
+ else \
+ sdt_might_sleep_strong_timeout(NULL); \
__ret = raw_wait_for_completion_io_timeout(x, t); \
sdt_might_sleep_finish(); \
__ret; \
@@ -169,7 +176,10 @@ extern long raw_wait_for_completion_killable_timeout(
#define wait_for_completion_interruptible_timeout(x, t) \
({ \
long __ret; \
- sdt_might_sleep_strong(NULL); \
+ if ((t) == MAX_SCHEDULE_TIMEOUT) \
+ sdt_might_sleep_strong(NULL); \
+ else \
+ sdt_might_sleep_strong_timeout(NULL); \
__ret = raw_wait_for_completion_interruptible_timeout(x, t);\
sdt_might_sleep_finish(); \
__ret; \
@@ -177,7 +187,10 @@ extern long raw_wait_for_completion_killable_timeout(
#define wait_for_completion_killable_timeout(x, t) \
({ \
long __ret; \
- sdt_might_sleep_strong(NULL); \
+ if ((t) == MAX_SCHEDULE_TIMEOUT) \
+ sdt_might_sleep_strong(NULL); \
+ else \
+ sdt_might_sleep_strong_timeout(NULL); \
__ret = raw_wait_for_completion_killable_timeout(x, t); \
sdt_might_sleep_finish(); \
__ret; \
--
1.9.1
\
 
 \ /
  Last update: 2023-03-26 23:32    [W:0.167 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site