Deleted Added
full compact
kern_thread.c (235459) kern_thread.c (236317)
1/*-
2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGE.
27 */
28
29#include "opt_witness.h"
30#include "opt_kdtrace.h"
31#include "opt_hwpmc_hooks.h"
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 2001 Julian Elischer <julian@freebsd.org>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGE.
27 */
28
29#include "opt_witness.h"
30#include "opt_kdtrace.h"
31#include "opt_hwpmc_hooks.h"
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/kern/kern_thread.c 235459 2012-05-15 01:30:25Z rstone $");
34__FBSDID("$FreeBSD: head/sys/kern/kern_thread.c 236317 2012-05-30 16:06:38Z kib $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/kernel.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/proc.h>
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/kernel.h>
39#include <sys/lock.h>
40#include <sys/mutex.h>
41#include <sys/proc.h>
42#include <sys/rangelock.h>
42#include <sys/resourcevar.h>
43#include <sys/sdt.h>
44#include <sys/smp.h>
45#include <sys/sched.h>
46#include <sys/sleepqueue.h>
47#include <sys/selinfo.h>
48#include <sys/turnstile.h>
49#include <sys/ktr.h>

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

200thread_init(void *mem, int size, int flags)
201{
202 struct thread *td;
203
204 td = (struct thread *)mem;
205
206 td->td_sleepqueue = sleepq_alloc();
207 td->td_turnstile = turnstile_alloc();
43#include <sys/resourcevar.h>
44#include <sys/sdt.h>
45#include <sys/smp.h>
46#include <sys/sched.h>
47#include <sys/sleepqueue.h>
48#include <sys/selinfo.h>
49#include <sys/turnstile.h>
50#include <sys/ktr.h>

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

201thread_init(void *mem, int size, int flags)
202{
203 struct thread *td;
204
205 td = (struct thread *)mem;
206
207 td->td_sleepqueue = sleepq_alloc();
208 td->td_turnstile = turnstile_alloc();
209 td->td_rlqe = NULL;
208 EVENTHANDLER_INVOKE(thread_init, td);
209 td->td_sched = (struct td_sched *)&td[1];
210 umtx_thread_init(td);
211 td->td_kstack = 0;
212 return (0);
213}
214
215/*
216 * Tear down type-stable parts of a thread (just before being discarded).
217 */
218static void
219thread_fini(void *mem, int size)
220{
221 struct thread *td;
222
223 td = (struct thread *)mem;
224 EVENTHANDLER_INVOKE(thread_fini, td);
210 EVENTHANDLER_INVOKE(thread_init, td);
211 td->td_sched = (struct td_sched *)&td[1];
212 umtx_thread_init(td);
213 td->td_kstack = 0;
214 return (0);
215}
216
217/*
218 * Tear down type-stable parts of a thread (just before being discarded).
219 */
220static void
221thread_fini(void *mem, int size)
222{
223 struct thread *td;
224
225 td = (struct thread *)mem;
226 EVENTHANDLER_INVOKE(thread_fini, td);
227 rlqentry_free(td->td_rlqe);
225 turnstile_free(td->td_turnstile);
226 sleepq_free(td->td_sleepqueue);
227 umtx_thread_fini(td);
228 seltdfini(td);
229}
230
231/*
232 * For a newly created process,

--- 805 unchanged lines hidden ---
228 turnstile_free(td->td_turnstile);
229 sleepq_free(td->td_sleepqueue);
230 umtx_thread_fini(td);
231 seltdfini(td);
232}
233
234/*
235 * For a newly created process,

--- 805 unchanged lines hidden ---