1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-07-28 15:41:55 +03:00
Commit Graph

152 Commits

Author SHA1 Message Date
affd9c086d Fix hardcoded page size, fixing test fails with 8k page and new kernel. 2011-03-06 16:47:43 +00:00
476ef1886f 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.
2011-02-18 14:51:04 +00:00
b1bcff7424 Critical section
New strategy for memory locking to decrease the number of call to
to un/lock memory when processing critical lvm functions.

Introducing functions for critical section.

Inside the critical section - memory is always locked.
When leaving the critical section, the memory stays locked
until memlock_unlock() is called - this happens with
sync_local_dev_names() and sync_dev_names() function call.

memlock_reset() is needed to reset locking numbers after fork
(polldaemon).

The patch itself is mostly rename:

memlock_inc  -> critical_section_inc
memlock_dec  -> critical_section_dec
memlock      -> critical_section

Daemons (clmvd, dmevent) are using memlock_daemon_inc&dec
(mlockall()) thus they will never release or relock memory they've
already locked memory.

Macros sync_local_dev_names() and sync_dev_names() are functions.
It's better for debugging - and also we do not need to add memlock.h
to locking.h header (for memlock_unlock() prototyp).
2011-02-18 14:16:11 +00:00
760d1fac55 Add more strict const pointers around config tree
To have better control were the config tree could be modified use more
const pointers and very carefully downcast them back to non-const
(for config tree merge).
2010-12-20 13:12:55 +00:00
aa4f87d6e3 Switch to char* arithmetic from void* 2010-10-25 13:00:35 +00:00
d1ad03efce Speedup memory un/locking
Move the call of find_config_tree_node() from inner loop to outer
section of maps scanning.
2010-10-15 09:48:23 +00:00
c631be7684 Maps fix
Read complete content of /proc/self/maps into one buffer without
realocation in the middle of reading and before doing any m/unlock
operation with these lines - as some of them gets change.
With previous implementation we've read some mappings twice ([stack])
2010-09-30 11:32:40 +00:00
764eb41086 Fix format string from patch apply mistake 2010-07-08 14:47:46 +00:00
37036b0215 Small update of memlock debug messages.
Gives slightly better alligned lines for reading.
2010-07-08 13:05:27 +00:00
d301e5917f Preload libc locale messages.
Preload libc.mo file for localized lvm before taking memory lock - this way
we prevent disk access for some error paths in libdm, that prints localized
errno messages while they are still in memory locked state.
2010-06-24 08:29:30 +00:00
ddf19eae0f Better debug message for Un/Locked memory size. 2010-04-01 14:53:47 +00:00
39b6ac476d Set ret value to success initially. 2010-04-01 13:43:12 +00:00
5de52e34f0 Count only readable size for memlock stats.
As we mlock() only readable pages, makes statistics only
for readable bytes.
2010-03-30 14:41:58 +00:00
3f67b36b35 Update memlock
Code moves initilization of stats values to _memlock_maps().
For dmeventd we need to use mlockall() - so avoid reading config value
and go with _use_mlockall code path.

Patch assumes dmeventd uses C locales!
Patch needs the call or memlock_inc_daemon() before memlock_inc()
(which is our common use case).

Some minor code cleanup patch for _un/_lock_mem_if_needed().
2010-03-30 14:41:23 +00:00
415feb2f44 some missing debug messages 2010-03-09 12:31:51 +00:00
d0c3da55a0 Update comments for selecting maps
Use dm_snprintf and check result whether we create correct /proc path name
2010-03-09 10:25:50 +00:00
f0f43bc093 Misc cleanups in the new mlock code, incl. improving some variable names
& messages; using more statics (for now) to avoid redundant
recalculation; validating config file just once on loading; keeping maps
file open.
2010-03-09 03:16:11 +00:00
4e27a85a2b Use mlock() only on 'r' memory maps 2010-03-08 17:14:21 +00:00
26ade5f27e Unconditionaly ignore also Virtual Dynamically-linked Shared Object
(VDSO on 32bit is VSyscall on 64bit)
It seems it could be locked on 64bit kernels running 32bit binaries,
but it makes troubles on real 32bit machines where mlock() returns
error when trying to lock such map area. (0xffffe000)
Behavior of mlockall() seems to be similar.
2010-03-08 15:55:52 +00:00
c900819b4e Use '_' prefix for local static variable. 2010-03-05 15:14:03 +00:00
18b82048e4 mlockall() -> mlock()
This patch adds a new implementation of locking function instead
of mlockall() that may lock way too much memory (>100MB).
New function instead uses mlock() system call and selectively locks
memory areas from /proc/self/maps trying to avoid locking areas
unused during lock-ed state.

Patch also adds struct cmd_context to all memlock() calls to have
access to configuration.

For backward compatibility functionality of mlockall()
is preserved with "activation/use_mlockall" flag.

As a simple check, locking and unlocking counts the amount of memory
and compares whether values are matching.
2010-03-05 14:48:33 +00:00
550cae2340 #define an INTERNAL_ERROR macro and use it throughout LVM. 2009-12-16 19:22:11 +00:00
4514bdcfa2 Fix another bug in memlock handling, this time the "global" dmeventd memlock
was preventing device scans in lvconvert --repair running from inside dmeventd.
2009-11-19 01:11:57 +00:00
39b1e58979 Issue an Internal error message whenever _memlock_count drops below 0. 2009-11-18 18:22:32 +00:00
0a5b690b70 fix setpriority int error 2008-05-28 23:12:45 +00:00
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
916490f8bf Add lvm_getpagesize wrapper. 2006-08-17 18:23:44 +00:00
2293567c8c Fix lvcreate corelog validation.
Add --config for overriding most config file settings from cmdline.
  Quote arguments when printing command line.
  Remove linefeed from 'initialising logging' message.
  Add 'Completed' debug message.
  Don't attempt library exit after reloading config files.
  Always compile with libdevmapper, even if device-mapper is disabled.
2006-05-16 16:48:31 +00:00
8a2fc58645 Check for libsepol.
Add some cflow & scope support.
Separate out DEFS from CFLAGS.
Remove inlines and use unique function names.
2006-04-19 15:33:07 +00:00
2262b32057 Use hash, bitset, malloc, pool from libdevmapper. 2005-10-16 23:03:59 +00:00
60f13f01d2 Basic support for mirrors. 2005-06-01 16:51:55 +00:00
c708ec79b1 Fix loopfiles mem alloc. 2005-05-09 17:02:52 +00:00
4d12267641 Un-inline dbg_strdup. 2005-05-09 17:01:06 +00:00
ed2799e7fe Fix some size_t printing. 2005-01-20 18:14:04 +00:00
894a05fffa Fix 64 bit xlate consts. 2005-01-20 18:13:17 +00:00
c3a4c63c15 Trap large memory allocation requests. 2004-11-24 21:34:56 +00:00
bd46a496c7 pool debugging 2004-11-23 18:23:23 +00:00
2b176f9034 Fix pool_empty so it really does empty the memory pool. 2004-09-16 20:09:55 +00:00
e26c4fd2a2 Some fixes to memory debugging code.
Exclude internal commands formats & segtypes from install.
2004-09-16 16:53:39 +00:00
28acccca2a Restructure xlate.h 2004-09-02 13:53:25 +00:00
6606c3ae81 Update copyright notices. 2004-03-30 19:35:44 +00:00
f22969328b tweak memlock includes 2004-03-26 21:11:34 +00:00
2534fa5203 Add string display to mem leak dump. 2004-03-26 21:09:44 +00:00
814643d8a2 rename config file vars & always use / as separator 2004-03-08 18:28:45 +00:00
a43a1312d2 don't inline pool_zalloc(); lift duplicated pool_str(n)dup to pool.c 2004-02-13 15:38:54 +00:00
034db45e26 Immediate error on big memory allocations when --enable-debug. 2003-11-13 23:54:02 +00:00
4c22730b53 Some tidyups and minor fixes. 2003-08-20 15:48:27 +00:00
914c97239f Another sync point - numerous fixes & clean ups. 2003-07-04 22:34:56 +00:00
9a079266dd Add pool_strndup 2003-04-24 21:58:34 +00:00