git: 5dedfeb5b3e1 - stable/13 - ksiginfo_alloc(): change to directly take M_WAITOK/NOWAIT flags
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 03 Sep 2022 01:29:19 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=5dedfeb5b3e1dd96a72f4e96d599d39f8f83862c
commit 5dedfeb5b3e1dd96a72f4e96d599d39f8f83862c
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-17 16:57:20 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-03 01:17:35 +0000
ksiginfo_alloc(): change to directly take M_WAITOK/NOWAIT flags
(cherry picked from commit cc29f221aaa218297ee4948b92da53f6126bc658)
---
sys/kern/kern_exit.c | 2 +-
sys/kern/kern_sig.c | 17 +++++++----------
sys/kern/kern_thread.c | 2 +-
sys/sys/signalvar.h | 2 +-
4 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index da60159fa391..ca32f318c0cf 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -503,7 +503,7 @@ exit1(struct thread *td, int rval, int signo)
wakeup(q->p_reaper);
for (; q != NULL; q = nq) {
nq = LIST_NEXT(q, p_sibling);
- ksi = ksiginfo_alloc(TRUE);
+ ksi = ksiginfo_alloc(M_WAITOK);
PROC_LOCK(q);
q->p_sigparent = SIGCHLD;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 994cbb3f2af9..54d2ed857c07 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -288,16 +288,13 @@ sigqueue_start(void)
}
ksiginfo_t *
-ksiginfo_alloc(int wait)
+ksiginfo_alloc(int mwait)
{
- int flags;
-
- flags = M_ZERO;
- if (! wait)
- flags |= M_NOWAIT;
- if (ksiginfo_zone != NULL)
- return ((ksiginfo_t *)uma_zalloc(ksiginfo_zone, flags));
- return (NULL);
+ MPASS(mwait == M_WAITOK || mwait == M_NOWAIT);
+
+ if (ksiginfo_zone == NULL)
+ return (NULL);
+ return (uma_zalloc(ksiginfo_zone, mwait | M_ZERO));
}
void
@@ -438,7 +435,7 @@ sigqueue_add(sigqueue_t *sq, int signo, ksiginfo_t *si)
if (p != NULL && p->p_pendingcnt >= max_pending_per_proc) {
signal_overflow++;
ret = EAGAIN;
- } else if ((ksi = ksiginfo_alloc(0)) == NULL) {
+ } else if ((ksi = ksiginfo_alloc(M_NOWAIT)) == NULL) {
signal_alloc_fail++;
ret = EAGAIN;
} else {
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index f7abb9f6f1fe..28de25d1ba18 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -468,7 +468,7 @@ proc_linkup(struct proc *p, struct thread *td)
{
sigqueue_init(&p->p_sigqueue, p);
- p->p_ksi = ksiginfo_alloc(1);
+ p->p_ksi = ksiginfo_alloc(M_WAITOK);
if (p->p_ksi != NULL) {
/* XXX p_ksi may be null if ksiginfo zone is not ready */
p->p_ksi->ksi_flags = KSI_EXT | KSI_INS;
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index d43dd4a44190..70f4f1bdaa50 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -385,7 +385,7 @@ int cursig(struct thread *td);
void execsigs(struct proc *p);
void gsignal(int pgid, int sig, ksiginfo_t *ksi);
void killproc(struct proc *p, const char *why);
-ksiginfo_t * ksiginfo_alloc(int wait);
+ksiginfo_t *ksiginfo_alloc(int mwait);
void ksiginfo_free(ksiginfo_t *ksi);
int pksignal(struct proc *p, int sig, ksiginfo_t *ksi);
void pgsigio(struct sigio **sigiop, int sig, int checkctty);