Deleted Added
full compact
vm_glue.c (52649) vm_glue.c (54188)
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
55 * School of Computer Science
56 * Carnegie Mellon University
57 * Pittsburgh PA 15213-3890
58 *
59 * any improvements or extensions that they make and grant Carnegie the
60 * rights to redistribute these changes.
61 *
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * The Mach Operating System project at Carnegie-Mellon University.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

54 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
55 * School of Computer Science
56 * Carnegie Mellon University
57 * Pittsburgh PA 15213-3890
58 *
59 * any improvements or extensions that they make and grant Carnegie the
60 * rights to redistribute these changes.
61 *
62 * $FreeBSD: head/sys/vm/vm_glue.c 52649 1999-10-30 09:09:02Z alc $
62 * $FreeBSD: head/sys/vm/vm_glue.c 54188 1999-12-06 04:53:08Z luoqi $
63 */
64
65#include "opt_rlimit.h"
66#include "opt_vm.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/proc.h>

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

204 */
205void
206vm_fork(p1, p2, flags)
207 register struct proc *p1, *p2;
208 int flags;
209{
210 register struct user *up;
211
63 */
64
65#include "opt_rlimit.h"
66#include "opt_vm.h"
67
68#include <sys/param.h>
69#include <sys/systm.h>
70#include <sys/proc.h>

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

204 */
205void
206vm_fork(p1, p2, flags)
207 register struct proc *p1, *p2;
208 int flags;
209{
210 register struct user *up;
211
212 if ((flags & RFPROC) == 0) {
213 /*
214 * Divorce the memory, if it is shared, essentially
215 * this changes shared memory amongst threads, into
216 * COW locally.
217 */
218 if ((flags & RFMEM) == 0) {
219 if (p1->p_vmspace->vm_refcnt > 1) {
220 vmspace_unshare(p1);
221 }
222 }
223 cpu_fork(p1, p2, flags);
224 return;
225 }
226
212 if (flags & RFMEM) {
213 p2->p_vmspace = p1->p_vmspace;
214 p1->p_vmspace->vm_refcnt++;
215 }
216
217 while (vm_page_count_severe()) {
218 VM_WAIT;
219 }

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

254 ((caddr_t) &up->u_stats.pstat_endcopy -
255 (caddr_t) &up->u_stats.pstat_startcopy));
256
257
258 /*
259 * cpu_fork will copy and update the pcb, set up the kernel stack,
260 * and make the child ready to run.
261 */
227 if (flags & RFMEM) {
228 p2->p_vmspace = p1->p_vmspace;
229 p1->p_vmspace->vm_refcnt++;
230 }
231
232 while (vm_page_count_severe()) {
233 VM_WAIT;
234 }

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

269 ((caddr_t) &up->u_stats.pstat_endcopy -
270 (caddr_t) &up->u_stats.pstat_startcopy));
271
272
273 /*
274 * cpu_fork will copy and update the pcb, set up the kernel stack,
275 * and make the child ready to run.
276 */
262 cpu_fork(p1, p2);
277 cpu_fork(p1, p2, flags);
263}
264
265/*
266 * Set default limits for VM system.
267 * Called for proc 0, and then inherited by all others.
268 *
269 * XXX should probably act directly on proc0.
270 */

--- 252 unchanged lines hidden ---
278}
279
280/*
281 * Set default limits for VM system.
282 * Called for proc 0, and then inherited by all others.
283 *
284 * XXX should probably act directly on proc0.
285 */

--- 252 unchanged lines hidden ---