• Andrey Vagin's avatar
    restore: optimize restorer_get_vma_hint · 363812c9
    Andrey Vagin authored
    It's an O(n) algorithm.
    
    Now we iterate both lists simultaneously to find a hole.
    
    [xemul: Discussion making the patch more understandable:
    
    Cyrill:
    
    	If s_vma is the last one on self_vma_list you could break immediately, no?
    
    	And the snippet I somehow miss is -- how the situation handled when
    
    		      hole
    		    a      b
    	source |----|      |-----|
    	target   |----|      |-----|
    		      c      d
    
    	the hole fits the requested size but the hole is shifted
    	in target, so that you've
    
    	prev_vma_end = a
    
    	and then you find that a - d > vma_len and return a
    	as start address for new mapping while finally it
    	might intersect with address c.
    
    	Or I miss something obvious?
    
    Andrey:
    
    	Look at "continue" one more time.
    	prev_vma_end is returned only if both condition are true
    
    	if (prev_vma_end + vma_len > s_vma->vma.start) {
    	....
    	if (prev_vma_end + vma_len > t_vma->vma.start) {
    	...
    Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
    Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    363812c9
Name
Last commit
Last update
Documentation Loading commit data...
include Loading commit data...
test Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
Makefile Loading commit data...
Makefile.inc Loading commit data...
README Loading commit data...
cr-check.c Loading commit data...
cr-dump.c Loading commit data...
cr-restore.c Loading commit data...
cr-show.c Loading commit data...
crtools.c Loading commit data...
file-ids.c Loading commit data...
files.c Loading commit data...
gen-offsets.sh Loading commit data...
ipc_ns.c Loading commit data...
libnetlink.c Loading commit data...
log.c Loading commit data...
namespaces.c Loading commit data...
parasite-syscall.c Loading commit data...
parasite.c Loading commit data...
parasite.lds.S Loading commit data...
pipes.c Loading commit data...
proc_parse.c Loading commit data...
ptrace.c Loading commit data...
rbtree.c Loading commit data...
restorer-log.c Loading commit data...
restorer.c Loading commit data...
restorer.lds.S Loading commit data...
sockets.c Loading commit data...
sysctl.c Loading commit data...
util-net.c Loading commit data...
util.c Loading commit data...
uts_ns.c Loading commit data...