Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp142777rwe; Fri, 26 Aug 2022 02:17:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dPdXvhPMIrGsWyzhCF8RfnCBC+CyBolUg2EOvkPr1VvhpfSDhq1tU5BhWNOpXCny6z6dN X-Received: by 2002:a17:902:6b82:b0:16d:d268:3842 with SMTP id p2-20020a1709026b8200b0016dd2683842mr2926583plk.16.1661505473501; Fri, 26 Aug 2022 02:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661505473; cv=none; d=google.com; s=arc-20160816; b=zhw9WcIFp5pYdoa/32Yx1XLvDH+hXPBr9vwU0A36cZR7MH4NcAvdc0yvsHPGCmi8dN PqI9ZUOcw1tiCVCH4IFR5TAYDwGUl8+LzT5GWW13IQcIMIkaoRxlNhEHoTLuNRcqmbpa NyHfa463sdgTwBpvo+NfC4JsWMuXx57717NTZwb4jlYbuyjKCKFjRCXYKxP7ZxHpqyvD 2rVfRa9W4+yTE3uahi+JE3RPfMqQHZtb5LykSe4emZVQ5Vgy0pyblwlDETjahVUsgfh7 QQARPyxBNsmbVYec9sh43H7vhAcYr+JcCFI76drceoTl7zYboQIj7g3nBstldzi4v/AT JEIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=k/YOAeMrO41lEY4+8aSzYGR7Fy/5LXHbHEaiBePREWM=; b=sOSzX0MP0OguElHxtldghAdppKSffvS8j10/uWYogoWyLuhIz6vaoclDmX03bT3LhA SPPzUNEmH3VXDLzoU9SmeUud77MnqtrWWTQZOpEZWQxqLQXHDsyYwjVKljg5DZ7sfjB5 mPqcOXtG8tIaN9XPJ7iI55J75dXlKIS33q++Chg67IkfL/uVXH8ZVfEidJrZf0FVcb49 MLzaJdJg9SYWEWe8Is/QOMdK+bizJFVpa3OFXOeVSqd79jR3HDcV3weoKy7VzxbUmazt zAxKAaYCXtidf1p74WnVrElk4WdgXpCIbkQ8JXGfYQlDRjIVGRzb6oFlFa23llKyrWMw B1kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=tlR6q+of; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a170902c95200b0016ec623eac3si1222728pla.239.2022.08.26.02.17.33; Fri, 26 Aug 2022 02:17:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=tlR6q+of; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245278AbiHZJH0 (ORCPT + 99 others); Fri, 26 Aug 2022 05:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245058AbiHZJHY (ORCPT ); Fri, 26 Aug 2022 05:07:24 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E5B8D5E94 for ; Fri, 26 Aug 2022 02:07:23 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A646833781; Fri, 26 Aug 2022 09:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661504841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k/YOAeMrO41lEY4+8aSzYGR7Fy/5LXHbHEaiBePREWM=; b=tlR6q+ofUogLpBrFZ+w22StOHygBtx7OUUPB0ad9FIEQzEvHibG4PDC4opUNsIw9IFxU2C KkHvt5u21e/p6un6qMfREWt9nutYriQozkCgcsWcePyUcIzGO3yRRKDT65cp2CQja7LV71 mSI/MaNNzvNc+DBbGXayEQ7JCukYdyA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661504841; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k/YOAeMrO41lEY4+8aSzYGR7Fy/5LXHbHEaiBePREWM=; b=Ctw1HYd5pXsNzHIjl0dbCWAY16hzc/YpRu1NvL6f+2QZgPVnI5cRo9XeKDMp2gO2SDoVMM ldJr/ZwKGjOSe0BQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 89EDD13421; Fri, 26 Aug 2022 09:07:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id v5OoIUmNCGPoNwAAMHmgww (envelope-from ); Fri, 26 Aug 2022 09:07:21 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 0F3CAA0679; Fri, 26 Aug 2022 11:07:21 +0200 (CEST) Date: Fri, 26 Aug 2022 11:07:21 +0200 From: Jan Kara To: Ojaswin Mujoo Cc: Jan Kara , Stefan Wahren , Ted Tso , linux-ext4@vger.kernel.org, Thorsten Leemhuis , Harshad Shirwadkar Subject: Re: [PATCH 0/2] ext4: Fix performance regression with mballoc Message-ID: <20220826090721.z2hn4rjffsyveeud@quack3> References: <20220823134508.27854-1-jack@suse.cz> <8e164532-c436-241f-33be-4b41f7f67235@i2se.com> <20220824104010.4qvw46zmf42te53n@quack3> <20220824141338.ailht7uzm6ihkofb@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 25-08-22 23:19:48, Ojaswin Mujoo wrote: > On Wed, Aug 24, 2022 at 04:13:38PM +0200, Jan Kara wrote: > > On Wed 24-08-22 12:40:10, Jan Kara wrote: > > > Hi Stefan! > > > > > > On Wed 24-08-22 12:17:14, Stefan Wahren wrote: > > > > Am 23.08.22 um 22:15 schrieb Jan Kara: > > > > > Hello, > > > > > > > > > > So I have implemented mballoc improvements to avoid spreading allocations > > > > > even with mb_optimize_scan=1. It fixes the performance regression I was able > > > > > to reproduce with reaim on my test machine: > > > > > > > > > > mb_optimize_scan=0 mb_optimize_scan=1 patched > > > > > Hmean disk-1 2076.12 ( 0.00%) 2099.37 ( 1.12%) 2032.52 ( -2.10%) > > > > > Hmean disk-41 92481.20 ( 0.00%) 83787.47 * -9.40%* 90308.37 ( -2.35%) > > > > > Hmean disk-81 155073.39 ( 0.00%) 135527.05 * -12.60%* 154285.71 ( -0.51%) > > > > > Hmean disk-121 185109.64 ( 0.00%) 166284.93 * -10.17%* 185298.62 ( 0.10%) > > > > > Hmean disk-161 229890.53 ( 0.00%) 207563.39 * -9.71%* 232883.32 * 1.30%* > > > > > Hmean disk-201 223333.33 ( 0.00%) 203235.59 * -9.00%* 221446.93 ( -0.84%) > > > > > Hmean disk-241 235735.25 ( 0.00%) 217705.51 * -7.65%* 239483.27 * 1.59%* > > > > > Hmean disk-281 266772.15 ( 0.00%) 241132.72 * -9.61%* 263108.62 ( -1.37%) > > > > > Hmean disk-321 265435.50 ( 0.00%) 245412.84 * -7.54%* 267277.27 ( 0.69%) > > > > > > > > > > Stefan, can you please test whether these patches fix the problem for you as > > > > > well? Comments & review welcome. > > > > > > > > i tested the whole series against 5.19 and 6.0.0-rc2. In both cases the > > > > update process succeed which is a improvement, but the download + unpack > > > > duration ( ~ 7 minutes ) is not as good as with mb_optimize_scan=0 ( ~ 1 > > > > minute ). > > > > > > OK, thanks for testing! I'll try to check specifically untar whether I can > > > still see some differences in the IO pattern on my test machine. > > > > I have created the same tar archive as you've referenced (files with same > > number of blocks) and looked at where blocks get allocated with > > mb_optimize_scan=0 and with mb_optimize_scan=1 + my patches. And the > > resulting IO pattern looks practically the same on my test machine. In > > particular in both cases files get allocated only in 6 groups, if I look > > at the number of erase blocks that are expected to be touched by file data > > (for various erase block sizes from 512k to 4MB) I get practically same > > numbers for both cases. > > > > Ojaswin, I think you've also mentioned you were able to reproduce the issue > > in your setup? Are you still able to reproduce it with the patched kernel? > > Can you help debugging while Stefan is away? > > > > Honza > Hi Jan, > > So I ran some more tests on v6.0-rc2 kernel with and without your patches and > here are the details: > > Workload:- > time tar -xf rpi-firmware.tar -C ./test > time sync > > System details: > - Rpi 3b+ w/ 8G memory card (~4G free) > - tar is ~120MB compressed Hum, maybe the difference is that I've tried with somewhat larger (20G) and otherwise empty filesystem... > And here is the output of time command for various tests. Since some of them > take some time to complete, I ran them only 2 3 times each so the numbers might > vary but they are indicative of the issue. > > v6.0-rc2 (Without patches) > > mb_optimize_scan = 0 > > **tar** > real 1m39.574s > user 0m10.311s > sys 0m2.761s > > **sync** > real 0m22.269s > user 0m0.001s > sys 0m0.005s > > mb_optimize_scan = 1 > > **tar** > real 21m25.288s > user 0m9.607 > sys 0m3.026 > > **sync** > real 1m23.402s > user 0m0.005s > sys 0m0.000s > > v6.0-rc2 (With patches) > > mb_optimize_scan = 0 > > * similar to unpatched (~1 to 2mins) * > > mb_optimize_scan = 1 > > **tar** > real 5m7.858s > user 0m11.008s > sys 0m2.739s > > **sync** > real 6m7.308s > user 0m0.003s > sys 0m0.001s > > At this point, I'm pretty confident that it is the untar operation that is > having most of the regression and no other download/delete operations in > rpi-update are behind the delay. Further, it does seem like your patches > improve the performance but, from my tests, we are still not close to the > mb_optimize_scan=0 numbers. Yes, thanks for the tests! > I'm going to spend some more time trying to collect the perfs and which block > group the allocations are happening during the untar to see if we can get a better > idea from that data. Let me know if you'd want me to collect anything else. > > PS: One question, to find the blocks groups being used I'm planning to take > the dumpe2fs output before and after untar and then see the groups where free blocks > changed (since there is nothing much running on Pi i assume this should give us > a rough idea of allocation pattern of untar), just wanted to check if there's a > better way to get this data. I have used 'find -exec filefrag -v {} \;' to get block numbers of files. That gets you better insight than plain dumpe2fs numbers... Honza -- Jan Kara SUSE Labs, CR