Deleted Added
full compact
subr_turnstile.c (170640) subr_turnstile.c (173600)
1/*-
2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 43 unchanged lines hidden (view full) ---

52 * already has a turnstile, then it gives its turnstile to the lock's
53 * turnstile's free list. When a thread is woken up, it takes a turnstile from
54 * the free list if there are any other waiters. If it is the only thread
55 * blocked on the lock, then it reclaims the turnstile associated with the lock
56 * and removes it from the hash table.
57 */
58
59#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 43 unchanged lines hidden (view full) ---

52 * already has a turnstile, then it gives its turnstile to the lock's
53 * turnstile's free list. When a thread is woken up, it takes a turnstile from
54 * the free list if there are any other waiters. If it is the only thread
55 * blocked on the lock, then it reclaims the turnstile associated with the lock
56 * and removes it from the hash table.
57 */
58
59#include <sys/cdefs.h>
60__FBSDID("$FreeBSD: head/sys/kern/subr_turnstile.c 170640 2007-06-12 23:27:31Z jeff $");
60__FBSDID("$FreeBSD: head/sys/kern/subr_turnstile.c 173600 2007-11-14 06:21:24Z julian $");
61
62#include "opt_ddb.h"
63#include "opt_turnstile_profiling.h"
64#include "opt_sched.h"
65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/kernel.h>

--- 185 unchanged lines hidden (view full) ---

254 KASSERT(td != curthread, ("Deadlock detected"));
255#endif
256
257 /*
258 * If we aren't blocked on a lock, we should be.
259 */
260 KASSERT(TD_ON_LOCK(td), (
261 "thread %d(%s):%d holds %s but isn't blocked on a lock\n",
61
62#include "opt_ddb.h"
63#include "opt_turnstile_profiling.h"
64#include "opt_sched.h"
65
66#include <sys/param.h>
67#include <sys/systm.h>
68#include <sys/kernel.h>

--- 185 unchanged lines hidden (view full) ---

254 KASSERT(td != curthread, ("Deadlock detected"));
255#endif
256
257 /*
258 * If we aren't blocked on a lock, we should be.
259 */
260 KASSERT(TD_ON_LOCK(td), (
261 "thread %d(%s):%d holds %s but isn't blocked on a lock\n",
262 td->td_tid, td->td_proc->p_comm, td->td_state,
262 td->td_tid, td->td_name, td->td_state,
263 ts->ts_lockobj->lo_name));
264
265 /*
266 * Pick up the lock that td is blocked on.
267 */
268 ts = td->td_blocked;
269 MPASS(ts != NULL);
270 MPASS(td->td_lock == &ts->ts_lock);

--- 748 unchanged lines hidden (view full) ---

1019
1020#ifdef DDB
1021static void
1022print_thread(struct thread *td, const char *prefix)
1023{
1024
1025 db_printf("%s%p (tid %d, pid %d, \"%s\")\n", prefix, td, td->td_tid,
1026 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
263 ts->ts_lockobj->lo_name));
264
265 /*
266 * Pick up the lock that td is blocked on.
267 */
268 ts = td->td_blocked;
269 MPASS(ts != NULL);
270 MPASS(td->td_lock == &ts->ts_lock);

--- 748 unchanged lines hidden (view full) ---

1019
1020#ifdef DDB
1021static void
1022print_thread(struct thread *td, const char *prefix)
1023{
1024
1025 db_printf("%s%p (tid %d, pid %d, \"%s\")\n", prefix, td, td->td_tid,
1026 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
1027 td->td_proc->p_comm);
1027 td->td_name);
1028}
1029
1030static void
1031print_queue(struct threadqueue *queue, const char *header, const char *prefix)
1032{
1033 struct thread *td;
1034
1035 db_printf("%s:\n", header);

--- 66 unchanged lines hidden (view full) ---

1102
1103 /*
1104 * Follow the chain. We keep walking as long as the thread is
1105 * blocked on a turnstile that has an owner.
1106 */
1107 while (!db_pager_quit) {
1108 db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid,
1109 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
1028}
1029
1030static void
1031print_queue(struct threadqueue *queue, const char *header, const char *prefix)
1032{
1033 struct thread *td;
1034
1035 db_printf("%s:\n", header);

--- 66 unchanged lines hidden (view full) ---

1102
1103 /*
1104 * Follow the chain. We keep walking as long as the thread is
1105 * blocked on a turnstile that has an owner.
1106 */
1107 while (!db_pager_quit) {
1108 db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid,
1109 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
1110 td->td_proc->p_comm);
1110 td->td_name);
1111 switch (td->td_state) {
1112 case TDS_INACTIVE:
1113 db_printf("is inactive\n");
1114 return;
1115 case TDS_CAN_RUN:
1116 db_printf("can run\n");
1117 return;
1118 case TDS_RUNQ:

--- 66 unchanged lines hidden (view full) ---

1185
1186 /*
1187 * Follow the chain. We keep walking as long as the thread is
1188 * blocked on a sleep lock that has an owner.
1189 */
1190 while (!db_pager_quit) {
1191 db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid,
1192 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
1111 switch (td->td_state) {
1112 case TDS_INACTIVE:
1113 db_printf("is inactive\n");
1114 return;
1115 case TDS_CAN_RUN:
1116 db_printf("can run\n");
1117 return;
1118 case TDS_RUNQ:

--- 66 unchanged lines hidden (view full) ---

1185
1186 /*
1187 * Follow the chain. We keep walking as long as the thread is
1188 * blocked on a sleep lock that has an owner.
1189 */
1190 while (!db_pager_quit) {
1191 db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid,
1192 td->td_proc->p_pid, td->td_name[0] != '\0' ? td->td_name :
1193 td->td_proc->p_comm);
1193 td->td_name);
1194 switch (td->td_state) {
1195 case TDS_INACTIVE:
1196 db_printf("is inactive\n");
1197 return;
1198 case TDS_CAN_RUN:
1199 db_printf("can run\n");
1200 return;
1201 case TDS_RUNQ:

--- 102 unchanged lines hidden ---
1194 switch (td->td_state) {
1195 case TDS_INACTIVE:
1196 db_printf("is inactive\n");
1197 return;
1198 case TDS_CAN_RUN:
1199 db_printf("can run\n");
1200 return;
1201 case TDS_RUNQ:

--- 102 unchanged lines hidden ---