Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2012 13:56:51 +0000 (UTC)
From:      Andrey Zonov <zont@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240499 - stable/9/sys/vm
Message-ID:  <201209141356.q8EDupI4034980@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zont
Date: Fri Sep 14 13:56:50 2012
New Revision: 240499
URL: http://svn.freebsd.org/changeset/base/240499

Log:
  MFC r239818:
  - Don't take an account of locked memory for current process in vslock(9).
  
  There are two consumers of vslock(9): sysctl code and drm driver.  These
  consumers are using locked memory as transient memory, it doesn't belong
  to a process's memory.
  
  MFC r239895:
  - Remove accounting of locked memory from vsunlock(9) that I missed in r239818.

Modified:
  stable/9/sys/vm/vm_glue.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_glue.c
==============================================================================
--- stable/9/sys/vm/vm_glue.c	Fri Sep 14 13:41:49 2012	(r240498)
+++ stable/9/sys/vm/vm_glue.c	Fri Sep 14 13:56:50 2012	(r240499)
@@ -183,7 +183,6 @@ int
 vslock(void *addr, size_t len)
 {
 	vm_offset_t end, last, start;
-	unsigned long nsize;
 	vm_size_t npages;
 	int error;
 
@@ -195,18 +194,6 @@ vslock(void *addr, size_t len)
 	npages = atop(end - start);
 	if (npages > vm_page_max_wired)
 		return (ENOMEM);
-	PROC_LOCK(curproc);
-	nsize = ptoa(npages +
-	    pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map)));
-	if (nsize > lim_cur(curproc, RLIMIT_MEMLOCK)) {
-		PROC_UNLOCK(curproc);
-		return (ENOMEM);
-	}
-	if (racct_set(curproc, RACCT_MEMLOCK, nsize)) {
-		PROC_UNLOCK(curproc);
-		return (ENOMEM);
-	}
-	PROC_UNLOCK(curproc);
 #if 0
 	/*
 	 * XXX - not yet
@@ -222,14 +209,6 @@ vslock(void *addr, size_t len)
 #endif
 	error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end,
 	    VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
-#ifdef RACCT
-	if (error != KERN_SUCCESS) {
-		PROC_LOCK(curproc);
-		racct_set(curproc, RACCT_MEMLOCK, 
-		    ptoa(pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map))));
-		PROC_UNLOCK(curproc);
-	}
-#endif
 	/*
 	 * Return EFAULT on error to match copy{in,out}() behaviour
 	 * rather than returning ENOMEM like mlock() would.
@@ -245,13 +224,6 @@ vsunlock(void *addr, size_t len)
 	(void)vm_map_unwire(&curproc->p_vmspace->vm_map,
 	    trunc_page((vm_offset_t)addr), round_page((vm_offset_t)addr + len),
 	    VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
-
-#ifdef RACCT
-	PROC_LOCK(curproc);
-	racct_set(curproc, RACCT_MEMLOCK,
-	    ptoa(pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map))));
-	PROC_UNLOCK(curproc);
-#endif
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209141356.q8EDupI4034980>