vm_machdep.c (ef90af83a58199ef3980d8c9a7dad07ec9b4bea3) vm_machdep.c (255c1caae364c686a9f87d97a31c70728f9377f1)
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * Copyright (c) 1989, 1990 William Jolitz
4 * Copyright (c) 1994 John Dyson
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer

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

47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/proc.h>
52#include <sys/socketvar.h>
53#include <sys/sf_buf.h>
54#include <sys/syscall.h>
1/*-
2 * Copyright (c) 1982, 1986 The Regents of the University of California.
3 * Copyright (c) 1989, 1990 William Jolitz
4 * Copyright (c) 1994 John Dyson
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * the Systems Programming Group of the University of Utah Computer

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

47#include <sys/systm.h>
48#include <sys/kernel.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/proc.h>
52#include <sys/socketvar.h>
53#include <sys/sf_buf.h>
54#include <sys/syscall.h>
55#include <sys/sysctl.h>
55#include <sys/sysent.h>
56#include <sys/unistd.h>
57#include <machine/cpu.h>
58#include <machine/pcb.h>
59#include <machine/sysarch.h>
60#include <sys/lock.h>
61#include <sys/mutex.h>
62

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

75
76/*
77 * struct switchframe and trapframe must both be a multiple of 8
78 * for correct stack alignment.
79 */
80CTASSERT(sizeof(struct switchframe) == 24);
81CTASSERT(sizeof(struct trapframe) == 80);
82
56#include <sys/sysent.h>
57#include <sys/unistd.h>
58#include <machine/cpu.h>
59#include <machine/pcb.h>
60#include <machine/sysarch.h>
61#include <sys/lock.h>
62#include <sys/mutex.h>
63

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

76
77/*
78 * struct switchframe and trapframe must both be a multiple of 8
79 * for correct stack alignment.
80 */
81CTASSERT(sizeof(struct switchframe) == 24);
82CTASSERT(sizeof(struct trapframe) == 80);
83
84#ifndef ARM_USE_SMALL_ALLOC
85
83#ifndef NSFBUFS
84#define NSFBUFS (512 + maxusers * 16)
85#endif
86
86#ifndef NSFBUFS
87#define NSFBUFS (512 + maxusers * 16)
88#endif
89
87#ifndef ARM_USE_SMALL_ALLOC
90static int nsfbufs;
91static int nsfbufspeak;
92static int nsfbufsused;
93
94SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufs, CTLFLAG_RDTUN, &nsfbufs, 0,
95 "Maximum number of sendfile(2) sf_bufs available");
96SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufspeak, CTLFLAG_RD, &nsfbufspeak, 0,
97 "Number of sendfile(2) sf_bufs at peak usage");
98SYSCTL_INT(_kern_ipc, OID_AUTO, nsfbufsused, CTLFLAG_RD, &nsfbufsused, 0,
99 "Number of sendfile(2) sf_bufs in use");
100
88static void sf_buf_init(void *arg);
89SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
90
91LIST_HEAD(sf_head, sf_buf);
101static void sf_buf_init(void *arg);
102SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL);
103
104LIST_HEAD(sf_head, sf_buf);
92
93
94/*
95 * A hash table of active sendfile(2) buffers
96 */
97static struct sf_head *sf_buf_active;
98static u_long sf_buf_hashmask;
99
100#define SF_BUF_HASH(m) (((m) - vm_page_array) & sf_buf_hashmask)
101
102static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
103static u_int sf_buf_alloc_want;
104
105/*
106 * A lock used to synchronize access to the hash table and free list
107 */
108static struct mtx sf_buf_lock;
105
106/*
107 * A hash table of active sendfile(2) buffers
108 */
109static struct sf_head *sf_buf_active;
110static u_long sf_buf_hashmask;
111
112#define SF_BUF_HASH(m) (((m) - vm_page_array) & sf_buf_hashmask)
113
114static TAILQ_HEAD(, sf_buf) sf_buf_freelist;
115static u_int sf_buf_alloc_want;
116
117/*
118 * A lock used to synchronize access to the hash table and free list
119 */
120static struct mtx sf_buf_lock;
109#endif
121#endif /* !ARM_USE_SMALL_ALLOC */
110
111/*
112 * Finish a fork operation, with process p2 nearly set up.
113 * Copy and update the pcb, set up the stack so that the child
114 * ready to run and return to user mode.
115 */
116void
117cpu_fork(register struct thread *td1, register struct proc *p2,

--- 619 unchanged lines hidden ---
122
123/*
124 * Finish a fork operation, with process p2 nearly set up.
125 * Copy and update the pcb, set up the stack so that the child
126 * ready to run and return to user mode.
127 */
128void
129cpu_fork(register struct thread *td1, register struct proc *p2,

--- 619 unchanged lines hidden ---