Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/thorpej-futex2]: src/sys Cherry-pick this sys_futex.c revision and assoc...
details: https://anonhg.NetBSD.org/src/rev/c40f6f7f318f
branches: thorpej-futex2
changeset: 991020:c40f6f7f318f
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Nov 03 14:49:21 2021 +0000
description:
Cherry-pick this sys_futex.c revision and associated changes:
revision 1.13
date: 2021-09-28 08:05:42 -0700; author: thorpej; state: Exp; lines: +11 -9; commitid: FPndTp2ZDjYuyJaD;
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.
...so make this easier to test this sys_futex.c with trunk.
diffstat:
sys/kern/kern_lwp.c | 9 +++------
sys/kern/sys_futex.c | 20 +++++++++++---------
sys/sys/futex.h | 4 ++--
3 files changed, 16 insertions(+), 17 deletions(-)
diffs (128 lines):
diff -r f03c2d0b005a -r c40f6f7f318f sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c Mon Nov 01 08:40:16 2021 +0000
+++ b/sys/kern/kern_lwp.c Wed Nov 03 14:49:21 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.243.12.1 2021/11/03 14:49:21 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.243.12.1 2021/11/03 14:49:21 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 f03c2d0b005a -r c40f6f7f318f sys/kern/sys_futex.c
--- a/sys/kern/sys_futex.c Mon Nov 01 08:40:16 2021 +0000
+++ b/sys/kern/sys_futex.c Wed Nov 03 14:49:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_futex.c,v 1.12.4.6 2021/11/01 08:40:16 chs Exp $ */
+/* $NetBSD: sys_futex.c,v 1.12.4.7 2021/11/03 14:49:21 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.4.6 2021/11/01 08:40:16 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.7 2021/11/03 14:49:21 thorpej Exp $");
/*
* Futexes
@@ -2199,7 +2199,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;
@@ -2209,13 +2209,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;
}
@@ -2237,21 +2239,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 f03c2d0b005a -r c40f6f7f318f sys/sys/futex.h
--- a/sys/sys/futex.h Mon Nov 01 08:40:16 2021 +0000
+++ b/sys/sys/futex.h Wed Nov 03 14:49:21 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.4.14.1 2021/11/03 14:49:21 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