Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp405283pxa; Tue, 4 Aug 2020 08:20:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3ohFsq0BhundfQzan5ZmBCJCS0uICzKfG82XAn0LO1kTvo1MIvPosq8RzJF6WKc/RRgbq X-Received: by 2002:a50:fc0e:: with SMTP id i14mr9601140edr.346.1596554418536; Tue, 04 Aug 2020 08:20:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596554418; cv=none; d=google.com; s=arc-20160816; b=yn1WVT/ZTVlzworb+eYD2SxkDTx1AN48jq68HwiQq6lbb75bQ4AWxJUKqf4gDlEaDX JdKkZzryn7m5TH38HSKuDSvbc71XgJ9EK6SK8MzNhwxXMwpwHV/cO8rJcWKjO+CRkQpo Vi7oGFat/J6v+hhvEJ8qMdFWKOr2VI7wHxOsa7PUfMH44mRJTb+FI2QRS/hyQvKRIuvO NUr7lXMjTnS6LAdHhYj6rpS6KHJMXCX7T98V1yIEQmKt3TpdIRiusqcuh6VF1Ltoxf3n +CFz3KOcnO5fvgRnlQ0+0HXax0X1lwvqv9elxFVvMxK+A/Cc/PfsQ46VDyPGmvP8nKWR vffA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from:dkim-signature; bh=LPySzTKUVWScjTIN3cHIfKZzXT4OE86By7kU7hXJQxA=; b=SvCpPjnf6U8plAxdly7vQAvFNGtUIAN0SKR5Fg6RJc/revcNKtb84TeyU9ExVJpQYg 8dYgb7X8/Gu4tbkZ7sJJMPZZLizlBp+4lKX1/7SHBUTSkau6xLTjThQ1/nFj4XpINws7 JznEt7Ul2bcgYAwhyp4sxSJ8LY+N0e8G9so5mB6E+hqPDBOvSlz0KQYZyUy2egURkTRD I8x8cx4jPB2S4JVRKVW59y8bxrzXUcvOiL05xV3dSEwGCYFM02kWnjXXwhnWTglDKT1z 4NY7tMiMIXaEDIxmnugsadxrE/3qkzUXoWvDs4mOE2UR++O4m8hEZM50TRfrSH818oOV 7cIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=X8KTiOFA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m29si13050712edb.298.2020.08.04.08.19.53; Tue, 04 Aug 2020 08:20:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=X8KTiOFA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729603AbgHDPRL (ORCPT + 99 others); Tue, 4 Aug 2020 11:17:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbgHDPRA (ORCPT ); Tue, 4 Aug 2020 11:17:00 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE2D2C06174A for ; Tue, 4 Aug 2020 08:16:59 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id x69so38732576qkb.1 for ; Tue, 04 Aug 2020 08:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=LPySzTKUVWScjTIN3cHIfKZzXT4OE86By7kU7hXJQxA=; b=X8KTiOFAbSLv2lUM5zEmyLuJ/WrCjl4JDEdDTPrMqThh8xSdY2a6HpCjh4cur4+Ssn OqePKqqkWB2W4EHRFlYUzsL1U2BrZC2A2rMxGvQFAs1nPFyFuGp+pyD16sofodKJ39gr zTxP+2lBf3r7q8vddytiwbya0G0QlV1bbIV5Nl3eSoWUpsAyviakDdK6P0PVqMxoMhE8 HJuQwfa08mu5CyxLoAiqWo289C+CrWTOT34h57BPgvOvRG1AZcL/snaUaAyLJdvSZT5y 5SPATYGLIhVQjg/sDUXDBmHY6vrwAaIQ4GhczhOvFGXmj9VYY5H9qXyzlv6hjGbPAgqS erkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=LPySzTKUVWScjTIN3cHIfKZzXT4OE86By7kU7hXJQxA=; b=R2JMB7qV0OPphxQ+rlqB+keADNJOjWYFWq7HrpKBJ6Q8YwYSKFt5dKxOGQL/bXJXes 0/+gR8PWL7P7jnhEtN2e9tL3v/GmouN0Cbb6lZSuYk7IoGFUNDxRx4PJuU+nKW7fCLZv pTUYiLF5pyAoUxSS3vuAkr4aI7+8evXD446/0O6VWrcj8wiE0PP4hgrZ3rYLWRKnIo+Z UNllmuXsqgH5JGn51klCAGzyzR8ZgAMYS6WUkTfcRo+pdeJ8UfNIWu30hi8HEYTk6N4f ddUj0q9upWwPuzo5npwGxkaTVkxlrLICobUZ7zx5oT/sxR50k32Wbp7qEIS8ovGzuNVc JaWQ== X-Gm-Message-State: AOAM533yPSJyBS2403SYArrI0tQoR9OjQLgL3u6yz1bz3FHX0xd8sFc7 sbeR6KvC9rW/sGvHz2NLPhI= X-Received: by 2002:a37:8047:: with SMTP id b68mr20146223qkd.299.1596554218832; Tue, 04 Aug 2020 08:16:58 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id 6sm21098319qkj.134.2020.08.04.08.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 08:16:57 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Tue, 4 Aug 2020 11:16:54 -0400 To: Pavel Machek Cc: Nick Terrell , Arvind Sankar , Nick Terrell , Ingo Molnar , Linux Kernel Mailing List , X86 ML , Kernel Team , Yann Collet , Gao Xiang , Sven Schmidt <4sschmid@informatik.uni-hamburg.de>, Andrew Morton , Greg Kroah-Hartman , Linus Torvalds Subject: Re: [PATCH] lz4: Fix kernel decompression speed Message-ID: <20200804151654.GA2326348@rani.riverdale.lan> References: <20200803194022.2966806-1-nickrterrell@gmail.com> <20200803215747.GA1644409@rani.riverdale.lan> <3961E1BD-8F58-4240-A3B3-B7032A405B42@fb.com> <20200804083236.zjkmfer37z5rn3r4@duo.ucw.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200804083236.zjkmfer37z5rn3r4@duo.ucw.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 04, 2020 at 10:32:36AM +0200, Pavel Machek wrote: > Hi! > > > >> I've measured the kernel decompression speed using QEMU before and after > > >> this patch for the x86_64 and i386 architectures. The speed-up is about > > >> 10x as shown below. > > >> > > >> Code Arch Kernel Size Time Speed > > >> v5.8 x86_64 11504832 B 148 ms 79 MB/s > > >> patch x86_64 11503872 B 13 ms 885 MB/s > > >> v5.8 i386 9621216 B 91 ms 106 MB/s > > >> patch i386 9620224 B 10 ms 962 MB/s > > >> > > >> I also measured the time to decompress the initramfs on x86_64, i386, > > >> and arm. All three show the same decompression speed before and after, > > >> as expected. > > >> > > >> [1] https://github.com/lz4/lz4/pull/890 > > >> > > > > > > Hi Nick, would you be able to test the below patch's performance to > > > verify it gives the same speedup? It removes the #undef in misc.c which > > > causes the decompressors to not use the builtin version. It should be > > > equivalent to yours except for applying it to all the decompressors. > > > > > > Thanks. > > > > I will measure it. I would expect it to provide the same speed up. It would be great to fix > > the problem for x86/i386 in general. > > > > But, I believe that this is also a problem for ARM, though I have a hard time measuring > > because I can’t get pre-boot print statements in QEMU. I will attempt to take a look at the > > assembly, because I’m fairly certain that memcpy() isn’t inlined in master. > > > > Even if we fix all the architectures, I would still like to merge the LZ4 patch. It seems like it > > is pretty easy to merge a patch that is a boot speed regression, because people aren’t > > actively measuring it. So I prefer a layered defense. > > > Layered defense against performance-only problem, happening on > emulation-only? > > IMO that's a bit of overkill. > > Best regards, > Pavel > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html Why would it be emulation-only? QEMU is just being used for ease of testing, but the performance impact should be similar on bare metal. Thanks.