Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp159878rdb; Mon, 22 Jan 2024 15:51:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFx7Bntkyu6zPeQnKcwiUhxD8XM/q69PUqHn0X/0Ito5bWFYx4cyIzBMJ6xT+7Bvyn6jnbX X-Received: by 2002:a62:d15a:0:b0:6d9:b327:c197 with SMTP id t26-20020a62d15a000000b006d9b327c197mr2484214pfl.39.1705967484809; Mon, 22 Jan 2024 15:51:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705967484; cv=pass; d=google.com; s=arc-20160816; b=qBremKVrouWbT5sdQHdBMX8CyNvhbfXlZZ4/H3C3V7/O1aDoiY8BbFujpt2DJM8zcV Om8G2mUlnFA1Gpln/z7oxbGISlN+YsPXZudeuqcpJTB6Dt6zBVNUiE7opAg7wiAl6s7c H6ChqBs4ADVyYnrPOX+ONRyHRwZB0JohOKeOzt2jX+5ZdiT5yAbkIgZHqgEFdZN7eqQ+ rYfql7JaRnTPP74PQ8rnQ8VMEiNADxUHheF2RsyBOtu4oeYk4WpCM7AR09Al1IHel5HV 4rYBXoGGhqJs2otVcpmYHZHHE7SA0qUUwuWKcURbCHLDnQVrEFAAS1IReg2AHxcdkG65 Kz5g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=JqOxVHoWuC6xC7ubsPPJY1ZmJL8w2E22Q/gtqtE3ZxE=; fh=Fdf+jp9eMRZ2w2yoCK996Ion0a5NmjLLnNiSbbx08Wk=; b=w5T/JHJhrhpGpns/JtLk794eHLBypT4XHcGC8WbBPTOqbWBzx+M7RvenU31vTX1Qgh PsCvNefKJmtQSMUm3JmSIEObnZw+lW3godtXcTbw4AzX7zNJOboFuv0h42TMMSVA+9WM Tb+D8gMRt4MiK/MUA5T9tl0nv2tRfyQwcyE/XKf1jozNB7GQFl9hIlaxeFgdOjfqnGPh PCR1F9DS5s8PHIWnXzEe1/pqlyAuklYAJcWeBI0EaHCvC4sFwKjrYNbi01LoK3+XDwKB NqcEIGeJUyVIMJSbgXTO73fXLA+035Gif9I1G68fd9IQJpT+xteY7FsYw7cVPE5yPHj1 8ZGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bur.io header.s=fm1 header.b=blxxj6lo; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=hbbLarQM; arc=pass (i=1 spf=pass spfdomain=bur.io dkim=pass dkdomain=bur.io dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-34303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34303-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id lc20-20020a056a004f5400b006da8b3df0desi10638648pfb.359.2024.01.22.15.51.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 15:51:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bur.io header.s=fm1 header.b=blxxj6lo; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=hbbLarQM; arc=pass (i=1 spf=pass spfdomain=bur.io dkim=pass dkdomain=bur.io dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-34303-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34303-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 350EEB24ABB for ; Mon, 22 Jan 2024 23:50:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C70E24E1D8; Mon, 22 Jan 2024 23:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b="blxxj6lo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hbbLarQM" Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (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 E819038DCC; Mon, 22 Jan 2024 23:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967428; cv=none; b=R1z3pK821A0B0iQrOiQQ6F3fIn/X5lS3OWWzfojyAo3j0RojXrc5tuJsYIU0cIu/fCCT2DXGZRfR52pj1h3HzSlxeSxyANB/maPkcKVidmuFqFVI6z0KY8v0nK1GA7O27lxfeBlzyD6eYIdMAuHo/BnmjbmPspSUKNBa7WTitzE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967428; c=relaxed/simple; bh=d6cfvBQNKPaaqqNpkhTE+uXaksS5FghTgNe444hBHgA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ihRoRAXxsXrajzxMrdbb+3fkv8Wou1sWws3OlJvqWkP4zua7YMOKEjF/MTzBFo2/KMz+MIj3VPP2JrfftMm7LExdX1AXYuaw8Af7HMNBBj+aIy9/6FLI4fc6yGRP35nQu9etgbuUf2lKUJ4MqpAkgBthMNQGCa9p04+v2U3ectc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io; spf=pass smtp.mailfrom=bur.io; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b=blxxj6lo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hbbLarQM; arc=none smtp.client-ip=64.147.123.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bur.io Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 439093200AF9; Mon, 22 Jan 2024 18:50:25 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Mon, 22 Jan 2024 18:50:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1705967424; x=1706053824; bh=JqOxVHoWuC 6xC7ubsPPJY1ZmJL8w2E22Q/gtqtE3ZxE=; b=blxxj6loUh7cotlSC+whGFFZZr ndTTrke/x8GTb2jVGso6DujyjzU07Ct49J+KQ3gKwMrW2OD3wU2jcoG1y8SL8kQ/ 4hIaPR8nkWVhGF8cl8t+hCEfNP5HJS2qE3c1qac3k8O2yqIzAYb+lmgfFb4YHcir RfWNxZMN+YZ7RGwPxI7+dV0XUsNqS2wIwkGToe9WlxlCtDLsnx5M/PjQ1y0utqtz M75yGchZi23FZ0Qx6nkBMlB1V3QI68takNQhq/BUs+GVWOEc5VMD6aaK09BMls6f I7n4niIlVl1D8zcXtYOcybJRbuv1TeAxVErZs6imSBzau62vHMB0v2B/e9mA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1705967424; x=1706053824; bh=JqOxVHoWuC6xC7ubsPPJY1ZmJL8w 2E22Q/gtqtE3ZxE=; b=hbbLarQMxaab5qu7O8qlYn1GfNnG7NUkIjNwnd5SeDlh V/UxR+UQ+zLvzV80HRobjRtW7dmaJ8XnTQfaNFOSMwqX9f1IfX74uDgAypd1S6sm M3JfJAbxOXG52L5UjK34kihRHuXkxcSV4PQgxE/OjqZ09VQ7HBc7MbKxA+mPaoJK AxtkTyC88PHTU6DktFUh4rtFWxQ8oFry8FQX2aW5uboD/CwkIbw5EYb2+3qBb+o6 g+wuYwRANkHpFWB2wqeKVbS6UJqf8O/bDcKhtdqn5YtMjbxnQ0IjzCxKtcPFcVS6 nL7db91veOEgiXU7smSBw1B7TKFgj4uZg3mc623mvA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdekjedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepuehorhhi shcuuehurhhkohhvuceosghorhhishessghurhdrihhoqeenucggtffrrghtthgvrhhnpe ekvdekffejleelhfevhedvjeduhfejtdfhvdevieeiiedugfeugfdtjefgfeeljeenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhrihhsse gsuhhrrdhioh X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 22 Jan 2024 18:50:23 -0500 (EST) Date: Mon, 22 Jan 2024 15:51:27 -0800 From: Boris Burkov To: Johannes Thumshirn Cc: Josef Bacik , David Sterba , Naohiro Aota , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Damien Le Moal Subject: Re: [PATCH 2/2] btrfs: zoned: wake up cleaner sooner if needed Message-ID: <20240122235127.GA1695621@zen.localdomain> References: <20240122-reclaim-fix-v1-0-761234a6d005@wdc.com> <20240122-reclaim-fix-v1-2-761234a6d005@wdc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240122-reclaim-fix-v1-2-761234a6d005@wdc.com> On Mon, Jan 22, 2024 at 02:51:04AM -0800, Johannes Thumshirn wrote: > On very fast but small devices, waiting for a transaction commit can be > too long of a wait in order to wake up the cleaner kthread to remove unused > and reclaimable block-groups. > > Check every time we're adding back free space to a block group, if we need > to activate the cleaner kthread. > > Signed-off-by: Johannes Thumshirn > --- > fs/btrfs/free-space-cache.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c > index d372c7ce0e6b..2d98b9ca0e83 100644 > --- a/fs/btrfs/free-space-cache.c > +++ b/fs/btrfs/free-space-cache.c > @@ -30,6 +30,7 @@ > #include "file-item.h" > #include "file.h" > #include "super.h" > +#include "zoned.h" > > #define BITS_PER_BITMAP (PAGE_SIZE * 8UL) > #define MAX_CACHE_BYTES_PER_GIG SZ_64K > @@ -2694,6 +2695,7 @@ int __btrfs_add_free_space(struct btrfs_block_group *block_group, > static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group, > u64 bytenr, u64 size, bool used) > { I thought add_free_space are only called from various error/backout conditions and then for real from unpin_extent_range, which is also in the transaction commit. The normal reclaim/unused decision is made in btrfs_update_block_group for that reason. OTOH, I assume you had some repro that was performing poorly and this patch fixed it so, I am very likely missing something. Thanks, Boris > + struct btrfs_fs_info *fs_info = block_group->fs_info; > struct btrfs_space_info *sinfo = block_group->space_info; > struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; > u64 offset = bytenr - block_group->start; > @@ -2745,6 +2747,10 @@ static int __btrfs_add_free_space_zoned(struct btrfs_block_group *block_group, > btrfs_mark_bg_to_reclaim(block_group); > } > > + if (btrfs_zoned_should_reclaim(fs_info) && > + !test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags)) > + wake_up_process(fs_info->cleaner_kthread); > + > return 0; > } > > > -- > 2.43.0 >