Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys futex_release_all_lwp(): No need to pass the "tid" argum...
details: https://anonhg.NetBSD.org/src/rev/0b4412c204ce
branches: trunk
changeset: 1023856:0b4412c204ce
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Sep 28 15:05:42 2021 +0000
description:
futex_release_all_lwp(): No need to pass the "tid" argument separately; that
is a vestige of an older version of the code. Also, move a KASSERT() that
both futex_release_all_lwp() call sites had inside of futex_release_all_lwp()
itself.
diffstat:
sys/kern/kern_exec.c | 7 +++----
sys/kern/kern_lwp.c | 9 +++------
sys/kern/sys_futex.c | 20 +++++++++++---------
sys/sys/futex.h | 4 ++--
4 files changed, 19 insertions(+), 21 deletions(-)
diffs (156 lines):
diff -r 0ea789093b64 -r 0b4412c204ce sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c Tue Sep 28 14:52:22 2021 +0000
+++ b/sys/kern/kern_exec.c Tue Sep 28 15:05:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_exec.c,v 1.507 2021/09/28 14:52:22 thorpej Exp $ */
+/* $NetBSD: kern_exec.c,v 1.508 2021/09/28 15:05:42 thorpej Exp $ */
/*-
* Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.507 2021/09/28 14:52:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.508 2021/09/28 15:05:42 thorpej Exp $");
#include "opt_exec.h"
#include "opt_execfmt.h"
@@ -1211,8 +1211,7 @@
* to dispose of. Do that now.
*/
if (__predict_false(l->l_robust_head != 0)) {
- KASSERT((l->l_lid & FUTEX_TID_MASK) == l->l_lid);
- futex_release_all_lwp(l, l->l_lid);
+ futex_release_all_lwp(l);
}
/* Destroy any lwpctl info. */
diff -r 0ea789093b64 -r 0b4412c204ce sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c Tue Sep 28 14:52:22 2021 +0000
+++ b/sys/kern/kern_lwp.c Tue Sep 28 15:05:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lwp.c,v 1.243 2021/01/13 07:36:56 skrll Exp $ */
+/* $NetBSD: kern_lwp.c,v 1.244 2021/09/28 15:05:42 thorpej Exp $ */
/*-
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -217,7 +217,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.243 2021/01/13 07:36:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.244 2021/09/28 15:05:42 thorpej Exp $");
#include "opt_ddb.h"
#include "opt_lockdebug.h"
@@ -2060,11 +2060,8 @@
void
lwp_thread_cleanup(struct lwp *l)
{
- const lwpid_t tid = l->l_lid;
- KASSERT((tid & FUTEX_TID_MASK) == tid);
KASSERT(mutex_owned(l->l_proc->p_lock));
-
mutex_exit(l->l_proc->p_lock);
/*
@@ -2072,7 +2069,7 @@
* now.
*/
if (__predict_false(l->l_robust_head != 0)) {
- futex_release_all_lwp(l, tid);
+ futex_release_all_lwp(l);
}
}
diff -r 0ea789093b64 -r 0b4412c204ce sys/kern/sys_futex.c
--- a/sys/kern/sys_futex.c Tue Sep 28 14:52:22 2021 +0000
+++ b/sys/kern/sys_futex.c Tue Sep 28 15:05:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_futex.c,v 1.12 2021/07/21 06:35:45 skrll Exp $ */
+/* $NetBSD: sys_futex.c,v 1.13 2021/09/28 15:05:42 thorpej Exp $ */
/*-
* Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12 2021/07/21 06:35:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.13 2021/09/28 15:05:42 thorpej Exp $");
/*
* Futexes
@@ -1966,7 +1966,7 @@
* the i's and cross the t's.
*/
void
-futex_release_all_lwp(struct lwp * const l, lwpid_t const tid)
+futex_release_all_lwp(struct lwp * const l)
{
u_long rhead[_FUTEX_ROBUST_HEAD_NWORDS];
int limit = 1000000;
@@ -1976,13 +1976,15 @@
if (l->l_robust_head == 0)
return;
+ KASSERT((l->l_lid & FUTEX_TID_MASK) == l->l_lid);
+
/* Read the final snapshot of the robust list head. */
error = futex_fetch_robust_head(l->l_robust_head, rhead);
if (error) {
- printf("WARNING: pid %jd (%s) lwp %jd tid %jd:"
+ printf("WARNING: pid %jd (%s) lwp %jd:"
" unmapped robust futex list head\n",
(uintmax_t)l->l_proc->p_pid, l->l_proc->p_comm,
- (uintmax_t)l->l_lid, (uintmax_t)tid);
+ (uintmax_t)l->l_lid);
return;
}
@@ -2004,21 +2006,21 @@
while (next != l->l_robust_head && limit-- > 0) {
/* pending handled below. */
if (next != pending)
- release_futex(next + offset, tid, is_pi, false);
+ release_futex(next + offset, l->l_lid, is_pi, false);
error = futex_fetch_robust_entry(next, &next, &is_pi);
if (error)
break;
preempt_point();
}
if (limit <= 0) {
- printf("WARNING: pid %jd (%s) lwp %jd tid %jd:"
+ printf("WARNING: pid %jd (%s) lwp %jd:"
" exhausted robust futex limit\n",
(uintmax_t)l->l_proc->p_pid, l->l_proc->p_comm,
- (uintmax_t)l->l_lid, (uintmax_t)tid);
+ (uintmax_t)l->l_lid);
}
/* If there's a pending futex, it may need to be released too. */
if (pending != 0) {
- release_futex(pending + offset, tid, pending_is_pi, true);
+ release_futex(pending + offset, l->l_lid, pending_is_pi, true);
}
}
diff -r 0ea789093b64 -r 0b4412c204ce sys/sys/futex.h
--- a/sys/sys/futex.h Tue Sep 28 14:52:22 2021 +0000
+++ b/sys/sys/futex.h Tue Sep 28 15:05:42 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: futex.h,v 1.4 2020/05/05 15:25:18 riastradh Exp $ */
+/* $NetBSD: futex.h,v 1.5 2021/09/28 15:05:42 thorpej Exp $ */
/*-
* Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
@@ -174,7 +174,7 @@
struct lwp;
int futex_robust_head_lookup(struct lwp *, lwpid_t, void **);
-void futex_release_all_lwp(struct lwp *, lwpid_t);
+void futex_release_all_lwp(struct lwp *);
int do_futex(int *, int, int, const struct timespec *, int *, int,
int, register_t *);
void futex_sys_init(void);
Home |
Main Index |
Thread Index |
Old Index