From 16aa248a357e9f22bc0584f7c41876d1e8bc539c Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 Feb 2011 14:51:04 +0000 Subject: [PATCH] Memory unlock allows 1 page difference 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. Allocation happens outside critical section probably during log_warn printing. Should make tests passing for now. --- lib/mm/memlock.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index 14f1cadfa..6698a31f0 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -343,9 +343,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)) -- 2.43.5