From owner-svn-src-head@freebsd.org Fri Dec 29 20:33:57 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C0FEEAF38D; Fri, 29 Dec 2017 20:33:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 145867AC37; Fri, 29 Dec 2017 20:33:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBTKXuW1010555; Fri, 29 Dec 2017 20:33:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBTKXu7E010554; Fri, 29 Dec 2017 20:33:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712292033.vBTKXu7E010554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 29 Dec 2017 20:33:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327359 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 327359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Dec 2017 20:33:57 -0000 Author: kib Date: Fri Dec 29 20:33:56 2017 New Revision: 327359 URL: https://svnweb.freebsd.org/changeset/base/327359 Log: Do not lock vm map in swapout_procs(). Neither swapout_procs() nor swapout() access the map. Since the process' vmspace is referenced only to obtain the pointer to the vm_map, the reference is not needed as well. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D13681 Modified: head/sys/vm/vm_swapout.c Modified: head/sys/vm/vm_swapout.c ============================================================================== --- head/sys/vm/vm_swapout.c Fri Dec 29 20:30:10 2017 (r327358) +++ head/sys/vm/vm_swapout.c Fri Dec 29 20:33:56 2017 (r327359) @@ -729,7 +729,6 @@ swapout_procs(int action) { struct proc *p; struct thread *td; - struct vmspace *vm; int minslptime, slptime; bool didswap; @@ -763,24 +762,6 @@ retry: PROC_UNLOCK(p); sx_sunlock(&allproc_lock); - /* - * Do not swapout a process that - * is waiting for VM data - * structures as there is a possible - * deadlock. Test this first as - * this may block. - * - * Lock the map until swapout - * finishes, or a thread of this - * process may attempt to alter - * the map. - */ - vm = vmspace_acquire_ref(p); - if (vm == NULL) - goto nextproc2; - if (!vm_map_trylock(&vm->vm_map)) - goto nextproc1; - PROC_LOCK(p); if (p->p_lock != 1 || (p->p_flag & (P_STOPPED_SINGLE | P_TRACED | P_SYSTEM)) != 0) @@ -867,17 +848,11 @@ retry: if (swapout(p) == 0) didswap = true; PROC_UNLOCK(p); - vm_map_unlock(&vm->vm_map); - vmspace_free(vm); goto retry; } } nextproc: PROC_UNLOCK(p); - vm_map_unlock(&vm->vm_map); -nextproc1: - vmspace_free(vm); -nextproc2: sx_slock(&allproc_lock); PRELE(p); }