mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
6dd0bd0255
Fix a silly bug in dm_stats_delete_region() that hugely inflates runtimes when deleting a large number of regions. For ~50,000 regions this change reduces the runtime from 98s to 6s on my test systems (a ~93% reduction). The bug exists because dm_stats_delete_region() applies a truth test to the return value of dm_stats_get_nr_areas(); this is never correct usage - it will walk the entire region table and calculate area counts for each region (which is roughly O(n^2) in the number of regions, as dm_stats_delete_region() is being called inside a region walk). Although the individual area calculation is not that costly, uselessly running anything 2,500,000,000 times over gets a bit slow. A much cheaper test (which is always true if the areas check is true) is to just test dm_stats_get_nr_regions() or dms->regions; if either is true it implies at least one area exists. Old: Performance counter stats for 'dmstats delete --allregions --alldevices': 98117.791458 task-clock (msec) # 1.000 CPUs utilized 127 context-switches # 0.001 K/sec 3 cpu-migrations # 0.000 K/sec 6,631 page-faults # 0.068 K/sec 307,711,724,562 cycles # 3.136 GHz 544,762,959,577 instructions # 1.77 insn per cycle 84,287,824,115 branches # 859.047 M/sec 2,538,875 branch-misses # 0.00% of all branches 98.119578733 seconds time elapsed New: Performance counter stats for 'dmstats delete --allregions --alldevices': 6427.251074 task-clock (msec) # 1.000 CPUs utilized 6 context-switches # 0.001 K/sec 0 cpu-migrations # 0.000 K/sec 6,634 page-faults # 0.001 M/sec 21,613,018,724 cycles # 3.363 GHz 3,794,755,445 instructions # 0.18 insn per cycle 852,974,026 branches # 132.712 M/sec 808,625 branch-misses # 0.09% of all branches 6.428953647 seconds time elapsed |
||
---|---|---|
.. | ||
datastruct | ||
ioctl | ||
misc | ||
mm | ||
regex | ||
.exported_symbols | ||
.exported_symbols.Base | ||
.exported_symbols.DM_1_02_97 | ||
.exported_symbols.DM_1_02_98 | ||
.exported_symbols.DM_1_02_99 | ||
.exported_symbols.DM_1_02_100 | ||
.exported_symbols.DM_1_02_101 | ||
.exported_symbols.DM_1_02_103 | ||
.exported_symbols.DM_1_02_104 | ||
.exported_symbols.DM_1_02_105 | ||
.exported_symbols.DM_1_02_106 | ||
.exported_symbols.DM_1_02_107 | ||
.exported_symbols.DM_1_02_110 | ||
.exported_symbols.DM_1_02_113 | ||
.exported_symbols.DM_1_02_124 | ||
.exported_symbols.DM_1_02_128 | ||
.exported_symbols.DM_1_02_129 | ||
.exported_symbols.DM_1_02_131 | ||
.exported_symbols.DM_1_02_133 | ||
.exported_symbols.DM_1_02_135 | ||
libdevmapper.h | ||
libdevmapper.pc.in | ||
libdm-common.c | ||
libdm-common.h | ||
libdm-config.c | ||
libdm-deptree.c | ||
libdm-file.c | ||
libdm-report.c | ||
libdm-stats.c | ||
libdm-string.c | ||
libdm-targets.c | ||
libdm-timestamp.c | ||
Makefile.in |