Date: Sat, 19 Jun 2004 15:26:21 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55314 for review Message-ID: <200406191526.i5JFQLDr021464@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=55314 Change 55314 by rwatson@rwatson_paprika on 2004/06/19 15:25:36 Integrate netperf_socket. Affected files ... .. //depot/projects/netperf_socket/sys/amd64/include/pmap.h#10 integrate .. //depot/projects/netperf_socket/sys/geom/geom_dev.c#4 integrate .. //depot/projects/netperf_socket/sys/i386/i386/machdep.c#7 integrate .. //depot/projects/netperf_socket/sys/kern/kern_descrip.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/kern_proc.c#9 integrate .. //depot/projects/netperf_socket/sys/kern/sysv_shm.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/vfs_syscalls.c#10 integrate .. //depot/projects/netperf_socket/sys/net/pfil.h#2 integrate .. //depot/projects/netperf_socket/sys/sys/_lock.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/file.h#3 integrate .. //depot/projects/netperf_socket/sys/sys/proc.h#12 integrate .. //depot/projects/netperf_socket/sys/sys/sysctl.h#7 integrate .. //depot/projects/netperf_socket/sys/sys/user.h#6 integrate .. //depot/projects/netperf_socket/sys/vm/vm_page.c#9 integrate Differences ... ==== //depot/projects/netperf_socket/sys/amd64/include/pmap.h#10 (text+ko) ==== @@ -39,7 +39,7 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.119 2004/06/14 01:17:50 alc Exp $ + * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.120 2004/06/19 14:58:34 bde Exp $ */ #ifndef _MACHINE_PMAP_H_ @@ -129,9 +129,9 @@ #ifndef LOCORE +#include <sys/queue.h> #include <sys/_lock.h> #include <sys/_mutex.h> -#include <sys/queue.h> typedef u_int64_t pd_entry_t; typedef u_int64_t pt_entry_t; ==== //depot/projects/netperf_socket/sys/geom/geom_dev.c#4 (text+ko) ==== @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/geom_dev.c,v 1.76 2004/06/17 21:24:12 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/geom_dev.c,v 1.77 2004/06/19 09:00:53 phk Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,6 +44,7 @@ #include <sys/bio.h> #include <sys/lock.h> #include <sys/mutex.h> +#include <sys/proc.h> #include <sys/errno.h> #include <sys/time.h> #include <sys/disk.h> @@ -160,6 +161,7 @@ g_trace(G_T_ACCESS, "g_dev_open(%s, %d, %d, %p)", gp->name, flags, fmt, td); + r = flags & FREAD ? 1 : 0; w = flags & FWRITE ? 1 : 0; #ifdef notyet @@ -167,6 +169,15 @@ #else e = 0; #endif + if (w) { + /* + * When running in very secure mode, do not allow + * opens for writing of any disks. + */ + error = securelevel_ge(td->td_ucred, 2); + if (error) + return (error); + } g_topology_lock(); if (dev->si_devsw == NULL) error = ENXIO; /* We were orphaned */ ==== //depot/projects/netperf_socket/sys/i386/i386/machdep.c#7 (text+ko) ==== @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.591 2004/06/16 09:47:07 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/machdep.c,v 1.592 2004/06/19 12:28:48 bde Exp $"); #include "opt_apic.h" #include "opt_atalk.h" @@ -1143,27 +1143,8 @@ td->td_pcb->pcb_flags &= ~FP_SOFTFP; /* - * Arrange to trap the next npx or `fwait' instruction (see npx.c - * for why fwait must be trapped at least if there is an npx or an - * emulator). This is mainly to handle the case where npx0 is not - * configured, since the npx routines normally set up the trap - * otherwise. It should be done only at boot time, but doing it - * here allows modifying `npx_exists' for testing the emulator on - * systems with an npx. - */ - load_cr0(rcr0() | CR0_MP | CR0_TS); - - /* Initialize the npx (if any) for the current process. */ - /* - * XXX the above load_cr0() also initializes it and is a layering - * violation if NPX is configured. It drops the npx partially - * and this would be fatal if we were interrupted now, and decided - * to force the state to the pcb, and checked the invariant - * (CR0_TS clear) if and only if PCPU_GET(fpcurthread) != NULL). - * ALL of this can happen except the check. The check used to - * happen and be fatal later when we didn't complete the drop - * before returning to user mode. This should be fixed properly - * soon. + * Drop the FP state if we hold it, so that the process gets a + * clean FP state if it uses the FPU again. */ fpstate_drop(td); @@ -1181,10 +1162,11 @@ unsigned int cr0; cr0 = rcr0(); -#ifdef SMP - cr0 |= CR0_NE; /* Done by npxinit() */ -#endif - cr0 |= CR0_MP | CR0_TS; /* Done at every execve() too. */ + /* + * CR0_MP, CR0_NE and CR0_TS are also set by npx_probe() for the + * BSP. See the comments there about why we set them. + */ + cr0 |= CR0_MP | CR0_NE | CR0_TS; #ifndef I386_CPU cr0 |= CR0_WP | CR0_AM; #endif ==== //depot/projects/netperf_socket/sys/kern/kern_descrip.c#10 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.234 2004/06/16 09:47:12 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_descrip.c,v 1.235 2004/06/19 11:40:08 phk Exp $"); #include "opt_compat.h" @@ -1326,6 +1326,8 @@ fp->f_count++; fp->f_cred = crhold(td->td_ucred); fp->f_ops = &badfileops; + fp->f_data = NULL; + fp->f_vnode = NULL; FILEDESC_LOCK(p->p_fd); if ((fq = p->p_fd->fd_ofiles[0])) { LIST_INSERT_AFTER(fq, fp, f_list); @@ -2360,6 +2362,7 @@ xf.xf_fd = n; xf.xf_file = fp; xf.xf_data = fp->f_data; + xf.xf_vnode = fp->f_vnode; xf.xf_type = fp->f_type; xf.xf_count = fp->f_count; xf.xf_msgcount = fp->f_msgcount; ==== //depot/projects/netperf_socket/sys/kern/kern_proc.c#9 (text+ko) ==== @@ -27,11 +27,11 @@ * SUCH DAMAGE. * * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 - * $FreeBSD: src/sys/kern/kern_proc.c,v 1.207 2004/06/17 17:16:48 phk Exp $ + * $FreeBSD: src/sys/kern/kern_proc.c,v 1.209 2004/06/19 14:09:40 gad Exp $ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.207 2004/06/17 17:16:48 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_proc.c,v 1.209 2004/06/19 14:09:40 gad Exp $"); #include "opt_ktrace.h" #include "opt_kstack_pages.h" @@ -694,10 +694,11 @@ kp->ki_start = p->p_stats->p_start; timevaladd(&kp->ki_start, &boottime); kp->ki_rusage = p->p_stats->p_ru; - kp->ki_childtime.tv_sec = p->p_stats->p_cru.ru_utime.tv_sec + - p->p_stats->p_cru.ru_stime.tv_sec; - kp->ki_childtime.tv_usec = p->p_stats->p_cru.ru_utime.tv_usec + - p->p_stats->p_cru.ru_stime.tv_usec; + kp->ki_childstime = p->p_stats->p_cru.ru_stime; + kp->ki_childutime = p->p_stats->p_cru.ru_utime; + /* Some callers want child-times in a single value */ + kp->ki_childtime = kp->ki_childstime; + timevaladd(&kp->ki_childtime, &kp->ki_childutime); } if (p->p_state != PRS_ZOMBIE) { #if 0 @@ -805,6 +806,9 @@ strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm)); strlcpy(kp->ki_ocomm, p->p_comm, sizeof(kp->ki_ocomm)); } + if (p->p_sysent && p->p_sysent->sv_name != NULL && + p->p_sysent->sv_name[0] != '\0') + strlcpy(kp->ki_emul, p->p_sysent->sv_name, sizeof(kp->ki_emul)); kp->ki_siglist = p->p_siglist; SIGSETOR(kp->ki_siglist, td->td_siglist); kp->ki_sigmask = td->td_sigmask; @@ -978,6 +982,14 @@ */ switch (oid_number) { + case KERN_PROC_GID: + if (p->p_ucred == NULL || + p->p_ucred->cr_gid != (gid_t)name[0]) { + PROC_UNLOCK(p); + continue; + } + break; + case KERN_PROC_PGRP: /* could do this by traversing pgrp */ if (p->p_pgrp == NULL || @@ -1187,6 +1199,9 @@ SYSCTL_PROC(_kern_proc, KERN_PROC_ALL, all, CTLFLAG_RD|CTLTYPE_STRUCT, 0, 0, sysctl_kern_proc, "S,proc", "Return entire process table"); +SYSCTL_NODE(_kern_proc, KERN_PROC_GID, gid, CTLFLAG_RD, + sysctl_kern_proc, "Process table"); + SYSCTL_NODE(_kern_proc, KERN_PROC_PGRP, pgrp, CTLFLAG_RD, sysctl_kern_proc, "Process table"); @@ -1217,6 +1232,9 @@ SYSCTL_NODE(_kern_proc, KERN_PROC_SV_NAME, sv_name, CTLFLAG_RD, sysctl_kern_proc_sv_name, "Process syscall vector name (ABI type)"); +SYSCTL_NODE(_kern_proc, (KERN_PROC_GID | KERN_PROC_INC_THREAD), gid_td, + CTLFLAG_RD, sysctl_kern_proc, "Process table"); + SYSCTL_NODE(_kern_proc, (KERN_PROC_PGRP | KERN_PROC_INC_THREAD), pgrp_td, CTLFLAG_RD, sysctl_kern_proc, "Process table"); ==== //depot/projects/netperf_socket/sys/kern/sysv_shm.c#4 (text+ko) ==== @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/sysv_shm.c,v 1.91 2004/05/30 20:34:58 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sysv_shm.c,v 1.92 2004/06/19 14:46:13 tjr Exp $"); #include "opt_compat.h" #include "opt_sysvipc.h" @@ -46,6 +46,7 @@ #include <sys/mman.h> #include <sys/module.h> #include <sys/mutex.h> +#include <sys/resourcevar.h> #include <sys/stat.h> #include <sys/syscall.h> #include <sys/syscallsubr.h> @@ -370,8 +371,10 @@ * This is just a hint to vm_map_find() about where to * put it. */ - attach_va = round_page((vm_offset_t)p->p_vmspace->vm_taddr - + maxtsiz + maxdsiz); + PROC_LOCK(p); + attach_va = round_page((vm_offset_t)p->p_vmspace->vm_daddr + + lim_max(p, RLIMIT_DATA)); + PROC_UNLOCK(p); } shm_handle = shmseg->shm_internal; ==== //depot/projects/netperf_socket/sys/kern/vfs_syscalls.c#10 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.349 2004/06/11 11:16:24 phk Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/vfs_syscalls.c,v 1.350 2004/06/19 11:41:45 phk Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -1033,9 +1033,11 @@ return (0); } fp->f_vnode = vp; - fp->f_data = vp; + if (fp->f_data == NULL) + fp->f_data = vp; fp->f_flag = flags & FMASK; - fp->f_ops = &vnops; + if (fp->f_ops == &badfileops) + fp->f_ops = &vnops; fp->f_seqcount = 1; fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE); FILEDESC_UNLOCK(fdp); ==== //depot/projects/netperf_socket/sys/net/pfil.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/net/pfil.h,v 1.10 2003/09/23 17:54:03 sam Exp $ */ +/* $FreeBSD: src/sys/net/pfil.h,v 1.11 2004/06/19 14:58:34 bde Exp $ */ /* $NetBSD: pfil.h,v 1.22 2003/06/23 12:57:08 martin Exp $ */ /* @@ -33,10 +33,10 @@ #define _NET_PFIL_H_ #include <sys/systm.h> +#include <sys/queue.h> #include <sys/_lock.h> #include <sys/_mutex.h> #include <sys/condvar.h> /* XXX */ -#include <sys/queue.h> struct mbuf; struct ifnet; ==== //depot/projects/netperf_socket/sys/sys/_lock.h#3 (text+ko) ==== @@ -25,14 +25,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/sys/_lock.h,v 1.9 2004/06/16 12:22:59 phk Exp $ + * $FreeBSD: src/sys/sys/_lock.h,v 1.10 2004/06/19 14:58:35 bde Exp $ */ #ifndef _SYS__LOCK_H_ #define _SYS__LOCK_H_ -#include <sys/queue.h> - struct lock_object { struct lock_class *lo_class; const char *lo_name; /* Individual lock name. */ ==== //depot/projects/netperf_socket/sys/sys/file.h#3 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)file.h 8.3 (Berkeley) 1/9/95 - * $FreeBSD: src/sys/sys/file.h,v 1.64 2004/04/07 04:19:49 imp Exp $ + * $FreeBSD: src/sys/sys/file.h,v 1.65 2004/06/19 11:38:00 phk Exp $ */ #ifndef _SYS_FILE_H_ @@ -149,6 +149,7 @@ int xf_msgcount; /* references from message queue */ off_t xf_offset; /* file offset */ void *xf_data; /* file descriptor specific data */ + void *xf_vnode; /* vnode pointer */ u_int xf_flag; /* flags (see fcntl.h) */ }; ==== //depot/projects/netperf_socket/sys/sys/proc.h#12 (text+ko) ==== @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)proc.h 8.15 (Berkeley) 5/19/95 - * $FreeBSD: src/sys/sys/proc.h,v 1.379 2004/06/16 00:26:30 julian Exp $ + * $FreeBSD: src/sys/sys/proc.h,v 1.380 2004/06/19 14:58:34 bde Exp $ */ #ifndef _SYS_PROC_H_ @@ -43,9 +43,9 @@ #ifndef _KERNEL #include <sys/filedesc.h> #endif +#include <sys/queue.h> #include <sys/_lock.h> #include <sys/_mutex.h> -#include <sys/queue.h> #include <sys/priority.h> #include <sys/rtprio.h> /* XXX. */ #include <sys/runq.h> ==== //depot/projects/netperf_socket/sys/sys/sysctl.h#7 (text+ko) ==== @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD: src/sys/sys/sysctl.h,v 1.130 2004/06/16 09:47:24 phk Exp $ + * $FreeBSD: src/sys/sys/sysctl.h,v 1.131 2004/06/19 13:42:05 gad Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -419,9 +419,10 @@ #define KERN_PROC_PROC 8 /* only return procs */ #define KERN_PROC_SV_NAME 9 /* get syscall vector name */ #define KERN_PROC_RGID 10 /* by real group id */ +#define KERN_PROC_GID 11 /* by effective group id */ #define KERN_PROC_INC_THREAD 0x10 /* * modifier for pid, pgrp, tty, - * uid, ruid, and proc + * uid, ruid, gid, rgid and proc */ /* ==== //depot/projects/netperf_socket/sys/sys/user.h#6 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)user.h 8.2 (Berkeley) 9/23/93 - * $FreeBSD: src/sys/sys/user.h,v 1.57 2004/06/17 17:16:53 phk Exp $ + * $FreeBSD: src/sys/sys/user.h,v 1.58 2004/06/19 13:49:25 gad Exp $ */ #ifndef _SYS_USER_H_ @@ -73,12 +73,15 @@ #if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || \ defined(__amd64__) #define KINFO_PROC_SIZE 912 /* the correct size for kinfo_proc */ +#define KI_NSPARE 16 /* number of spare longs to define */ #endif -#if __i386__ || defined __arm__ +#if defined(__i386__) || defined(__arm__) #define KINFO_PROC_SIZE 648 /* the correct size for kinfo_proc */ +#define KI_NSPARE 15 #endif #ifdef __powerpc__ #define KINFO_PROC_SIZE 656 +#define KI_NSPARE 16 #endif #ifndef KINFO_PROC_SIZE #error "Unknown architecture" @@ -87,6 +90,7 @@ #define LOCKNAMELEN 8 /* size of returned lock name */ #define OCOMMLEN 16 /* size of returned ki_ocomm name */ #define COMMLEN 19 /* size of returned ki_comm name */ +#define KI_EMULNAMELEN 16 /* size of returned ki_emul */ #define KI_NGROUPS 16 /* number of groups in ki_groups */ #define LOGNAMELEN 17 /* size of returned ki_login */ @@ -108,6 +112,7 @@ pid_t ki_sid; /* Process session ID */ pid_t ki_tsid; /* Terminal session ID */ short ki_jobc; /* job control counter */ + short ki_spare_short1; /* unused (just here for alignment) */ dev_t ki_tdev; /* controlling tty dev */ sigset_t ki_siglist; /* Signals arrived but not delivered */ sigset_t ki_sigmask; /* Current signal mask */ @@ -119,6 +124,7 @@ gid_t ki_rgid; /* Real group id */ gid_t ki_svgid; /* Saved effective group id */ short ki_ngroups; /* number of groups */ + short ki_spare_short2; /* unused (just here for alignment) */ gid_t ki_groups[KI_NGROUPS]; /* groups */ vm_size_t ki_size; /* virtual size */ segsz_t ki_rssize; /* current resident set size in pages */ @@ -149,14 +155,20 @@ char ki_login[LOGNAMELEN+1]; /* setlogin name */ char ki_lockname[LOCKNAMELEN+1]; /* lock name */ char ki_comm[COMMLEN+1]; /* command name */ - char ki_sparestrings[85]; /* spare string space */ + char ki_emul[KI_EMULNAMELEN+1]; /* emulation name */ + char ki_sparestrings[68]; /* spare string space */ struct rusage ki_rusage; /* process rusage statistics */ long ki_sflag; /* PS_* flags */ struct priority ki_pri; /* process priority */ long ki_tdflags; /* XXXKSE kthread flag */ struct pcb *ki_pcb; /* kernel virtual addr of pcb */ void *ki_kstack; /* kernel virtual addr of stack */ - long ki_spare[22]; /* spare constants */ + struct timeval ki_childstime; /* system time used by children */ + struct timeval ki_childutime; /* user time used by children */ + segsz_t ki_ps_segsz1; /* used by `ps', for its processing */ + float ki_ps_float1; /* used by `ps', for its processing */ + int ki_spare_int1; /* unused (just here for alignment) */ + long ki_spare[KI_NSPARE]; /* spare room for later growth */ }; void fill_kinfo_proc(struct proc *, struct kinfo_proc *); ==== //depot/projects/netperf_socket/sys/vm/vm_page.c#9 (text+ko) ==== @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.285 2004/06/17 06:16:58 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/vm/vm_page.c,v 1.286 2004/06/19 04:19:47 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -515,7 +515,7 @@ * enter the page into the kernel's pmap. We are not allowed to block * here so we *can't* do this anyway. * - * The object and page must be locked, and must be splhigh. + * The object and page must be locked. * This routine may not block. */ void @@ -581,7 +581,7 @@ * table and the object page list, but do not invalidate/terminate * the backing store. * - * The object and page must be locked, and at splhigh. + * The object and page must be locked. * The underlying pmap entry (if any) is NOT removed here. * This routine may not block. */ @@ -664,8 +664,6 @@ * The object must be locked. * This routine may not block. * - * Note: this routine will raise itself to splvm(), the caller need not. - * * Note: swap associated with the page must be invalidated by the move. We * have to do this for several reasons: (1) we aren't freeing the * page, (2) we are dirtying the page, (3) the VM system is probably @@ -681,15 +679,12 @@ void vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex) { - int s; - s = splvm(); vm_page_remove(m); vm_page_insert(m, new_object, new_pindex); if (m->queue - m->pc == PQ_CACHE) vm_page_deactivate(m); vm_page_dirty(m); - splx(s); } /* @@ -699,7 +694,6 @@ * might be found, but not applicable, they are deactivated. This * keeps us from using potentially busy cached pages. * - * This routine must be called at splvm(). * This routine may not block. */ vm_page_t @@ -750,7 +744,7 @@ { vm_object_t m_object; vm_page_t m = NULL; - int color, flags, page_req, s; + int color, flags, page_req; page_req = req & VM_ALLOC_CLASS_MASK; @@ -769,7 +763,6 @@ page_req = VM_ALLOC_SYSTEM; }; - s = splvm(); loop: mtx_lock_spin(&vm_page_queue_free_mtx); if (cnt.v_free_count > cnt.v_free_reserved || @@ -792,7 +785,6 @@ vm_page_lock_queues(); if ((m = vm_page_select_cache(color)) == NULL) { vm_page_unlock_queues(); - splx(s); #if defined(DIAGNOSTIC) if (cnt.v_cache_count > 0) printf("vm_page_alloc(NORMAL): missing pages on cache queue: %d\n", cnt.v_cache_count); @@ -814,7 +806,6 @@ * Not allocatable from cache from interrupt, give up. */ mtx_unlock_spin(&vm_page_queue_free_mtx); - splx(s); atomic_add_int(&vm_pageout_deficit, 1); pagedaemon_wakeup(); return (NULL); @@ -826,13 +817,12 @@ KASSERT( m != NULL, - ("vm_page_alloc(): missing page on free queue\n") + ("vm_page_alloc(): missing page on free queue") ); /* * Remove from free queue */ - vm_pageq_remove_nowakeup(m); /* @@ -859,12 +849,6 @@ KASSERT(m->dirty == 0, ("vm_page_alloc: free/cache page %p was dirty", m)); mtx_unlock_spin(&vm_page_queue_free_mtx); - /* - * vm_page_insert() is safe prior to the splx(). Note also that - * inserting a page here does not insert it into the pmap (which - * could cause us to block allocating memory). We cannot block - * anywhere. - */ if ((req & VM_ALLOC_NOOBJ) == 0) vm_page_insert(m, object, pindex); else @@ -877,7 +861,6 @@ if (vm_paging_needed()) pagedaemon_wakeup(); - splx(s); return (m); } @@ -890,9 +873,7 @@ void vm_wait(void) { - int s; - s = splvm(); vm_page_lock_queues(); if (curproc == pageproc) { vm_pageout_pages_needed = 1; @@ -906,7 +887,6 @@ msleep(&cnt.v_free_count, &vm_page_queue_mtx, PDROP | PVM, "vmwait", 0); } - splx(s); } /* @@ -922,9 +902,7 @@ void vm_waitpfault(void) { - int s; - s = splvm(); vm_page_lock_queues(); if (!vm_pages_needed) { vm_pages_needed = 1; @@ -932,7 +910,6 @@ } msleep(&cnt.v_free_count, &vm_page_queue_mtx, PDROP | PUSER, "pfault", 0); - splx(s); } /* @@ -948,10 +925,8 @@ void vm_page_activate(vm_page_t m) { - int s; mtx_assert(&vm_page_queue_mtx, MA_OWNED); - s = splvm(); if (m->queue != PQ_ACTIVE) { if ((m->queue - m->pc) == PQ_CACHE) cnt.v_reactivated++; @@ -965,7 +940,6 @@ if (m->act_count < ACT_INIT) m->act_count = ACT_INIT; } - splx(s); } /* @@ -975,8 +949,8 @@ * routine is called when a page has been added to the cache or free * queues. * + * The page queues must be locked. * This routine may not block. - * This routine must be called at splvm() */ static __inline void vm_page_free_wakeup(void) @@ -1016,12 +990,10 @@ void vm_page_free_toq(vm_page_t m) { - int s; struct vpgqueues *pq; vm_object_t object = m->object; mtx_assert(&vm_page_queue_mtx, MA_OWNED); - s = splvm(); cnt.v_tfree++; if (m->busy || ((m->queue - m->pc) == PQ_FREE)) { @@ -1049,7 +1021,6 @@ * return, otherwise delay object association removal. */ if ((m->flags & PG_FICTITIOUS) != 0) { - splx(s); return; } @@ -1061,7 +1032,7 @@ panic("vm_page_free: invalid wire count (%d), pindex: 0x%lx", m->wire_count, (long)m->pindex); } - panic("vm_page_free: freeing wired page\n"); + panic("vm_page_free: freeing wired page"); } /* @@ -1111,7 +1082,6 @@ } mtx_unlock_spin(&vm_page_queue_free_mtx); vm_page_free_wakeup(); - splx(s); } /* @@ -1135,16 +1105,13 @@ void vm_page_unmanage(vm_page_t m) { - int s; - s = splvm(); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & PG_UNMANAGED) == 0) { if (m->wire_count == 0) vm_pageq_remove(m); } vm_page_flag_set(m, PG_UNMANAGED); - splx(s); } /* @@ -1160,14 +1127,12 @@ void vm_page_wire(vm_page_t m) { - int s; /* * Only bump the wire statistics if the page is not already wired, * and only unqueue the page if it is on some queue (if it is unmanaged * it is already off the queues). */ - s = splvm(); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (m->flags & PG_FICTITIOUS) return; @@ -1178,7 +1143,6 @@ } m->wire_count++; KASSERT(m->wire_count != 0, ("vm_page_wire: wire_count overflow m=%p", m)); - splx(s); } /* @@ -1212,9 +1176,7 @@ void vm_page_unwire(vm_page_t m, int activate) { - int s; - s = splvm(); mtx_assert(&vm_page_queue_mtx, MA_OWNED); if (m->flags & PG_FICTITIOUS) return; @@ -1232,9 +1194,8 @@ } } } else { - panic("vm_page_unwire: invalid wire count: %d\n", m->wire_count); + panic("vm_page_unwire: invalid wire count: %d", m->wire_count); } - splx(s); } @@ -1251,16 +1212,14 @@ static __inline void _vm_page_deactivate(vm_page_t m, int athead) { - int s; mtx_assert(&vm_page_queue_mtx, MA_OWNED); + /* * Ignore if already inactive. */ if (m->queue == PQ_INACTIVE) return; - - s = splvm(); if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if ((m->queue - m->pc) == PQ_CACHE) cnt.v_reactivated++; @@ -1274,7 +1233,6 @@ vm_page_queues[PQ_INACTIVE].lcnt++; cnt.v_inactive_count++; } - splx(s); } void @@ -1339,7 +1297,6 @@ void vm_page_cache(vm_page_t m) { - int s; mtx_assert(&vm_page_queue_mtx, MA_OWNED); if ((m->flags & (PG_BUSY|PG_UNMANAGED)) || m->busy || @@ -1359,11 +1316,9 @@ panic("vm_page_cache: caching a dirty page, pindex: %ld", (long)m->pindex); } - s = splvm(); vm_pageq_remove_nowakeup(m); vm_pageq_enqueue(PQ_CACHE + m->pc, m); vm_page_free_wakeup(); - splx(s); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406191526.i5JFQLDr021464>