Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Dec 2010 13:22:07 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 187160 for review
Message-ID:  <201012231322.oBNDM75v037182@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@187160?ac=10

Change 187160 by trasz@trasz_victim on 2010/12/23 13:21:05

	Fix error handling in vslock().

Affected files ...

.. //depot/projects/soc2009/trasz_limits/TODO#36 edit
.. //depot/projects/soc2009/trasz_limits/sys/vm/vm_glue.c#11 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/TODO#36 (text+ko) ====

@@ -100,6 +100,8 @@
    to be investigated; there are many of them and it wouldn't be user-friendly
    to add ten new resource counters.
 
+ - What about RLIMIT_RTPRIO and RLIMIT_RTTIME?  Linux seems to have these.
+
 HRL-specific issues:
 
  - Reconsider setrlimit(2) handling.

==== //depot/projects/soc2009/trasz_limits/sys/vm/vm_glue.c#11 (text+ko) ====

@@ -200,8 +200,7 @@
 	PROC_LOCK(curproc);
 	nsize = ptoa(npages +
 	    pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map)));
-	if (nsize > lim_cur(curproc, RLIMIT_MEMLOCK) ||
-	    rusage_set(curproc, RUSAGE_MEMLOCK, nsize) != 0) {
+	if (nsize > lim_cur(curproc, RLIMIT_MEMLOCK)) {
 		PROC_UNLOCK(curproc);
 		return (ENOMEM);
 	}
@@ -219,10 +218,12 @@
 	if (npages + cnt.v_wire_count > vm_page_max_wired)
 		return (EAGAIN);
 #endif
+	if (rusage_set(curproc, RUSAGE_MEMLOCK, nsize))
+		return (ENOMEM);
 	error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end,
 	    VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES);
 	if (error != KERN_SUCCESS)
-		rusage_sub(curproc, RUSAGE_MEMLOCK, 
+		rusage_set(curproc, RUSAGE_MEMLOCK, 
 		    ptoa(pmap_wired_count(vm_map_pmap(&curproc->p_vmspace->vm_map))));
 	/*
 	 * Return EFAULT on error to match copy{in,out}() behaviour



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