Replace cv_{timed}wait_sig with cv_{timed}wait_idle where appropriate

There are a number of places where cv_?_sig is used simply for
accounting purposes but the surrounding code has no ability to
cope with actually receiving a signal. On FreeBSD it is possible
to send signals to individual kernel threads so this could
enable undesirable behavior.

This patch adds routines on Linux that will do the same idle
accounting as _sig without making the task interruptible. On
FreeBSD cv_*_idle  are all aliases for cv_*

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #10843
This commit is contained in:
Matthew Macy
2020-09-03 20:04:09 -07:00
committed by Brian Behlendorf
parent fd20a81b9a
commit 36f36610c3
11 changed files with 73 additions and 25 deletions
+8 -2
View File
@@ -142,8 +142,14 @@ cv_timedwait_sig(kcondvar_t *cvp, kmutex_t *mp, clock_t timo)
return (1);
}
#define cv_timedwait_io cv_timedwait
#define cv_timedwait_sig_io cv_timedwait_sig
#define cv_timedwait_io cv_timedwait
#define cv_timedwait_idle cv_timedwait
#define cv_timedwait_sig_io cv_timedwait_sig
#define cv_wait_io cv_wait
#define cv_wait_io_sig cv_wait_sig
#define cv_wait_idle cv_wait
#define cv_timedwait_io_hires cv_timedwait_hires
#define cv_timedwait_idle_hires cv_timedwait_hires
static inline int
cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,
@@ -41,9 +41,6 @@
#include <sys/ccompat.h>
#include <linux/types.h>
#define cv_wait_io(cv, mp) cv_wait(cv, mp)
#define cv_wait_io_sig(cv, mp) cv_wait_sig(cv, mp)
#define cond_resched() kern_yield(PRI_USER)
#define taskq_create_sysdc(a, b, d, e, p, dc, f) \
@@ -84,7 +81,6 @@ typedef int fstrans_cookie_t;
#define signal_pending(x) SIGPENDING(x)
#define current curthread
#define thread_join(x)
#define cv_wait_io(cv, mp) cv_wait(cv, mp)
typedef struct opensolaris_utsname utsname_t;
extern utsname_t *utsname(void);
extern int spa_import_rootpool(const char *name, bool checkpointrewind);