From owner-freebsd-arm@FreeBSD.ORG Sat Jun 21 12:13:05 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A22C782C; Sat, 21 Jun 2014 12:13:05 +0000 (UTC) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E89CC2D85; Sat, 21 Jun 2014 12:13:04 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id hi2so2111177wib.4 for ; Sat, 21 Jun 2014 05:13:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yHZR7G/LNwP1SKVPisnbW1QpvfnGA1D4zMWOs2DiV8o=; b=0OfSmqqkopMGqr/GBGl8CXwmg/hQo6/U33XVqbDlN1d0+bDDPrsvcq+s9tz1nEVB0D vr7qbd51AeE9xFe136+TAn6jmQA014fDRtfcomQccdqgtvhKJxiI93sQgIWGocpy8dwH BIeoRGXZXQwqNOirnFFPXyWklhWfrUKLQpzV84n1hfjwEyhlgOaz9L/xX+CTO7oSG7+e D6dzbYpG9PuKohL/WuJERVdbXffCqN6OXorpqXyceZCi7tMXsCRfvSBs3vKuzuxy096b UwsXNL+x5j87pspg9Ho47nF7Z+PfS1V9mpqHlSPiz755aexZ/dhdPdbKLU/ijpb+KCet LsQg== MIME-Version: 1.0 X-Received: by 10.194.91.144 with SMTP id ce16mr11446868wjb.18.1403352782359; Sat, 21 Jun 2014 05:13:02 -0700 (PDT) Received: by 10.216.23.1 with HTTP; Sat, 21 Jun 2014 05:13:01 -0700 (PDT) In-Reply-To: <1403193531.20883.269.camel@revolution.hippie.lan> References: <1403193531.20883.269.camel@revolution.hippie.lan> Date: Sat, 21 Jun 2014 14:13:01 +0200 Message-ID: Subject: Re: Strange slowdown of zlib. From: Magnus Nilsson To: Ian Lepore Content-Type: text/plain; charset=UTF-8 Cc: freebsd-arm , freebsd-embedded@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jun 2014 12:13:05 -0000 On Thu, Jun 19, 2014 at 5:58 PM, Ian Lepore wrote: > On Thu, 2014-06-19 at 17:44 +0200, Magnus Nilsson wrote: >> I have the strangest behaviour of zlib on FreeBSD 8.2 (ARM, but I don't >> think it's necessarily an ARM specific issue). >> Doing >> # md5 /lib/libz.so.5 >> or >> # cp /lib/libz.so.5 /tmp/ >> # export LD_LIBRARY_PATH=/tmp/ >> slows down applications (I've tested bsdtar and gzip) using zlib to a crawl >> on my system. >> >> In the later case, doing >> # unset LD_LIBRARY_PATH >> reverts the issue. >> However, I haven't found any way to recover from the first case, apart from >> rebooting - then the execution time is back to normal. >> >> Here is a log of what I describe above (first moving zlib, then doing the >> md5): >> # cp some2MBfile /tmp/ >> # time gzip /tmp/some2MBfile >> real 0m0.325s >> user 0m0.284s >> sys 0m0.037s >> # rm /tmp/some2MBfile.gz >> # cp /lib/libz.so.5 /tmp/ >> # export LD_LIBRARY_PATH=/tmp/ >> # cp some2MBfile /tmp/ >> # time gzip /tmp/some2MBfile >> real 0m11.949s >> user 0m11.635s >> sys 0m0.035s >> # rm /tmp/some2MBfile.gz >> # unset LD_LIBRARY_PATH >> # cp some2MBfile /tmp/ >> # time gzip /tmp/some2MBfile >> real 0m0.325s >> user 0m0.288s >> sys 0m0.035s >> # rm /tmp/some2MBfile.gz >> # md5 /lib/libz.so.5 >> # cp some2MBfile /tmp/ >> # time gzip /tmp/some2MBfile >> real 0m11.919s >> user 0m11.608s >> sys 0m0.031s >> # rm /tmp/some2MBfile.gz >> >> Do you have any idea what could be going on? >> Any clues are welcome. >> >> Kind regards/Magnus > > This is a known problem on armv4/v5 in freebsd 8. Here is some archived > info on it including patches that work around the problem (rather > crudely, but good enough for our needs at $work). > > http://lists.freebsd.org/pipermail/freebsd-arm/2012-January/003288.html > > -- Ian > > Unfortunately, both your patches from http://lists.freebsd.org/pipermail/freebsd-arm/2012-January/003288.html were already in. Enabling O_DIRECT in ffs_read() in ffs_vnops_icache_hack.bin makes no difference either. I have patched r224049, r221844, r212507 and r209223 (r205028 and r203637 were already in) mentioned by Warner Losh in http://lists.freebsd.org/pipermail/freebsd-arm/2012-January/003292.html in case they'd make any difference, but no. If I run Maks Verver's simple testcase from http://lists.freebsd.org/pipermail/freebsd-arm/2010-March/002243.html , it consistently runs ~15s on my 1GHz CPU. After 'cat testcase > /dev/null', it takes ~14min of course. While e.g. cat or md5 of an executable affects its speed, e.g. cp does not. Could there be some read access that's unaffected by your patches? (As I said privately, thank you very much for setting me on the right track!) KR/Magnus