From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26167 invoked by alias); 27 Mar 2013 21:13:47 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 26118 invoked by uid 48); 27 Mar 2013 21:13:40 -0000 From: "law at redhat dot com" To: glibc-bugs@sourceware.org Subject: [Bug dynamic-link/15310] _dl_sort_fini is O(n^3) causing slow exit when many dsos Date: Wed, 27 Mar 2013 21:13:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: dynamic-link X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: law at redhat dot com X-Bugzilla-Status: WAITING X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg00152.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=15310 --- Comment #7 from law at redhat dot com 2013-03-27 21:13:39 UTC --- Carlos, This is the tester QE uses for the correctness of the sort: Basically it takes as an input the number of DSOs you want to test. Then builds a random orderings and a pathological ordering of those DSOs on the link line (the script knows the dependencies between DSOs). deps.cpp: #include #ifdef MAIN int main( int argc, char *argv[] ) { printf("main\n"); } #else static bool deps_init( void ) { puts( NAME ); } bool x = deps_init(); #endif driver: #!/bin/bash # based on reproducer from bug 11724 N=${1:-2} TmpDir=$(mktemp -d) cp deps.cpp $TmpDir pushd $TmpDir > /dev/null 2>&1 for((all=0,k=2; k<=$N; ++all,++k)); do cmd="g++ -fPIC -shared -o libdeps${k}.so -DNAME=\\\"${k}\\\" deps.cpp" printf "# %s\n" "$cmd" > ${all}r.log eval "$cmd" for ((i=k-1; i>=1; --i)); do cmd="g++ -L. -fPIC -shared -o libdeps${i}.so -ldeps$((i+1)) -DNAME=\\\"${i}\\\" deps.cpp" printf "# %s\n" "$cmd" >> ${all}r.log eval "$cmd" done; unset i # random link order # it sucks that rhel5 coreutils don't have shuf or sort -R yet :) roptions=($(seq 1 $k | sed 's/^/ -ldeps/')) for ((i=(${#roptions[@]}-1); i >= 1; --i)); do random=$((RANDOM % i)) m=${roptions[$random]} roptions[$random]=${roptions[$i]} roptions[$i]=$m done; unset i rcmd="g++ -Wl,-rpath -Wl,$(pwd) -L. -o rmain ${roptions[@]} -DMAIN deps.cpp" # pathological link order poptions=($(seq $k -1 1 | sed 's/^/ -ldeps/')) pcmd="g++ -Wl,-rpath -Wl,$(pwd) -L. -o pmain ${poptions[@]} -DMAIN deps.cpp" cp ${all}r.log ${all}p.log for i in r p; do cmd="${i}cmd" printf "# %s\n\n" "${!cmd}" >> ${all}${i}.log eval "${!cmd}" fail=0 cp ${all}${i}.log ${i}out.golden ./${i}main >> ${all}${i}.log seq $k -1 1 >> ${i}out.golden echo main >> ${i}out.golden diff ${all}${i}.log ${i}out.golden > /dev/null 2>&1 || fail=1 # it's ok, we don't care if [ 0 -eq $fail ]; then rm ${all}${i}.log fi done; unset i rm -rf *.so *main *out.golden *out.real done; unset k rm deps.cpp test 0 -eq $(ls | wc -l) && { rm -rf $(pwd); echo PASS; } || { echo FAIL; printf "results are in %s\n" $(pwd); } popd > /dev/null 2>&1 -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.