Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1415689lqj; Tue, 4 Jun 2024 00:09:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+xCI7whBzTXYkZ57ofoh40rgfssjKrdWn6cz4sGu6gkIBAo9J2dS5Kxripn/KLNEZRCcwPe1mSjCztLC/zXe0HMjcBJWjQB7AEfq9Vg== X-Google-Smtp-Source: AGHT+IFJOuMpjjrvjbr/xsEF9jTWYtyPLlyzdGWyOEta1UBTywjvQ8uoAmFKjup3jRgLRBtBx27F X-Received: by 2002:a2e:988f:0:b0:2ea:79b2:1839 with SMTP id 38308e7fff4ca-2ea950e77f9mr93659001fa.2.1717484969324; Tue, 04 Jun 2024 00:09:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717484969; cv=pass; d=google.com; s=arc-20160816; b=rwvh1nL1UrbKi0vqflZo655wiIBiMoukQeHpy6sZ+V5ckA5I1+ALc6MkFgJby7+/iq wjSY48zGtQuPBUY7z/Mp6/iXddisGEKndLJZ5DQKodbgYS+o5jBGIOdLK/5yEvd9KFFv k+V9V/Ay0RV2wpX1mdK82PwXcKbus8a/Sq2DQwbRKwHHpGMEJAIi3qhLmHiFUwb+lGKO 1juBbstcU/vZAXUH+MHOwJ3H8eNVcm6iHpJXiRMhHr8DI1U83RhNglKLPWblOLi2JzpV ps/lMG4m4zKfS1ypWvuPjlw0IqsazLNtFml2X0oDHI/yuKMCTGrjbC65tzBeDflm6S43 JA8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:user-agent:date :message-id:from:references:cc:to:subject; bh=cUmRJ6BL8ymvHQzetVErfke5dtMGltpgjwUSNrVDp+Y=; fh=4LQ6EAD8f9aa3SQrm7CsKBMyk5nn8I5fd9B4oBicDZo=; b=JhvoY47Y9oGDWiNumR8JPpXLbSzYEGBWnv5o/Dw5PLs2rN4NwP/P5nKYKH/8Zd8OxH LOmRMUU4fSRtqHSEHxC0nmKoQtcfWlCa+8uZOtbWG7/7KdjtxskDx4MuYIzGVK3uVikv frjkMQTDVaizqsXZmF43YFdjK+bDqUHHEcKs8t+y3G3JNCHizEC+/11nanFutyprSVJT NYgjZSKTzgMjml3JcUJ/SMyOj/gKPswgf5vd1Wdyhvsja7kscUENFgBTefvZ6a/KruFH rJrN0mrLGLTpLrT5kxFRIesYYWtmhEQ2pHvm92pZBnShBnVU4tKDCBYKfzNw7/I2ZACS jwKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-200133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200133-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6972b6b7ddsi10514266b.666.2024.06.04.00.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:09:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-200133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200133-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DB7B61F25F58 for ; Tue, 4 Jun 2024 07:09:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2B32140381; Tue, 4 Jun 2024 07:09:16 +0000 (UTC) Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4959C2209B; Tue, 4 Jun 2024 07:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717484956; cv=none; b=f5eCi6NDobIXXV4u2W5RH4DFIuX3UVGQpbcOiatmceKt0zflf0w0bkoPlQrC8zP0qGU7GEhzKJNe9PIJrQudMZTL8xK0Ft70+ZJXHHgOEquVTHudOdBerzzSnpvzKksrTKYiBHW/9GguMTk5dTvuyhC/hCDOP+6ZTdD+qQ8iZk8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717484956; c=relaxed/simple; bh=4iq3XeNrs7ltIrmz0ZFJGziDx9dE933s9OG2qHDTALw=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=VggV+qJ3AerzTMhbuKMzulihhSaFJCL5QLh8Q4yc7AvxgM6f1/8REyOiu3htxKTUuVn6Di+BnpRFrUsIVykGMy//ctrkG6F6sPQOQQsLwblDjFVYXUf0LvUojF9p9HJsdU3WAw8RwVqF6weGdBZPBYO8QMpwT2Kx1i2Ve0ljLHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4VthXQ1B46z4f3jJ3; Tue, 4 Jun 2024 15:08:54 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.75]) by mail.maildlp.com (Postfix) with ESMTP id BF0101A0185; Tue, 4 Jun 2024 15:09:03 +0800 (CST) Received: from [10.174.179.80] (unknown [10.174.179.80]) by APP2 (Coremail) with SMTP id Syh0CgC32w6NvV5mPr6ROw--.1471S3; Tue, 04 Jun 2024 15:09:03 +0800 (CST) Subject: Re: [RFC PATCH v4 8/8] xfs: improve truncate on a realtime inode with huge extsize To: "Darrick J. Wong" , Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, brauner@kernel.org, david@fromorbit.com, chandanbabu@kernel.org, jack@suse.cz, willy@infradead.org, yi.zhang@huawei.com, chengzhihao1@huawei.com, yukuai3@huawei.com References: <20240529095206.2568162-1-yi.zhang@huaweicloud.com> <20240529095206.2568162-9-yi.zhang@huaweicloud.com> <20240531141210.GI52987@frogsfrogsfrogs> <20240531150016.GL52987@frogsfrogsfrogs> From: Zhang Yi Message-ID: <7b7d8062-65c3-9659-230a-bc8dea4785f6@huaweicloud.com> Date: Tue, 4 Jun 2024 15:09:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240531150016.GL52987@frogsfrogsfrogs> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CM-TRANSID:Syh0CgC32w6NvV5mPr6ROw--.1471S3 X-Coremail-Antispam: 1UD129KBjvJXoW7AF4Utw1rGrWxurWftry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J. Wong wrote: > On Fri, May 31, 2024 at 07:15:34AM -0700, Christoph Hellwig wrote: >> On Fri, May 31, 2024 at 07:12:10AM -0700, Darrick J. Wong wrote: >>> There are some users that want 1G extents. >>> >>> For the rest of us who don't live in the stratosphere, it's convenient >>> for fsdax to have rt extents that match the PMD size, which could be >>> large on arm64 (e.g. 512M, or two smr sectors). >> >> That's fine. Maybe to rephrase my question. With this series we >> have 3 different truncate path: >> >> 1) unmap all blocks (!rt || rtextsizse == 1) >> 2) zero leftover blocks in an rtextent (small rtextsize, but > 1) >> 3) converted leftover block in an rtextent to unwritten (large >> rtextsize) >> >> What is the right threshold to switch between 2 and 3? And do we >> really need 2) at all? > > I don't think we need (2) at all. > > There's likely some threshold below where it's a wash -- compare with > ext4 strategy of trying to write 64k chunks even if that requires > zeroing pagecache to cut down on fragmentation on hdds -- but I don't > know if we care anymore. ;) > I supplemented some tests for small > 1 rtextsizes on my ramdisk, mkfs.xfs -f -m reflink=0,rmapbt=0, -d rtinherit=1 \ -r rtdev=/dev/pmem1s,extsize=$rtextsize /dev/pmem2s mount -ortdev=/dev/pmem1s /dev/pmem2s /mnt/scratch for i in {1..1000}; \ do dd if=/dev/zero of=/mnt/scratch/$i bs=$rtextsize count=1; done sync time for i in {1..1000}; \ do xfs_io -c "truncate 4k" /mnt/scratch/$i; done rtextsize 8k 16k 32k 64k 256k 1024k zero out: 9.601s 10.229s 11.153s 12.086s 12.259s 20.141s convert unwritten: 9.710s 9.642s 9.958s 9.441s 10.021s 10.526s The test showed that there is no much difference between (2) and (3) with small rtextsize, but if the size gets progressively larger, (3) will be better, so I agree with you that we could just drop (2) for rt device. Thanks, Yi.