[lvm-devel] [PATCH 13/24] Memory unlock allows 1 page difference

Zdenek Kabelac zkabelac at redhat.com
Sun Jan 30 12:57:36 UTC 2011


As the kernel seems to be doing weird things during
mlock -> munlock -  allow 1 page locking difference without
warning - and log just debug message for a 1 page difference.

Do not scary users too often.

Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
 lib/mm/memlock.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 062b765..9ddc2a2 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -320,9 +320,15 @@ static void _unlock_mem(struct cmd_context *cmd)
 			log_sys_error("close", _procselfmaps);
 		dm_free(_maps_buffer);
 		_maps_buffer = NULL;
-		if (_mstats < unlock_mstats)
-			log_error(INTERNAL_ERROR "Maps lock %ld < unlock %ld",
-				  (long)_mstats, (long)unlock_mstats);
+		if (_mstats < unlock_mstats) {
+			if ((_mstats + 4096) < unlock_mstats)
+				log_error(INTERNAL_ERROR
+					  "Maps lock %ld < unlock %ld",
+					  (long)_mstats, (long)unlock_mstats);
+			else
+				log_debug("Maps lock %ld < unlock %ld, 1 page difference!",
+					  (long)_mstats, (long)unlock_mstats);
+		}
 	}
 
 	if (setpriority(PRIO_PROCESS, 0, _priority))
-- 
1.7.3.5




More information about the lvm-devel mailing list