Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp522886rdb; Thu, 8 Feb 2024 12:43:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVuKtkeZ56lnQV7BwdSiHiOK/mpTPFOGy5xIRNioSN41DssMHNnG7gOtyT/kOVNAmO84qtKGS27Hk/G5bK4vj6pFAcX6oqwOD7YjapY8w== X-Google-Smtp-Source: AGHT+IHGM3Oqpq5FNARkyNk+KslI8e5P3HMknVWuQLsIKyCzVB8SaSaKTiqAVEpjH+qmTAjTL7Pu X-Received: by 2002:a05:6358:3403:b0:178:20ea:abb5 with SMTP id h3-20020a056358340300b0017820eaabb5mr231981rwd.26.1707425000591; Thu, 08 Feb 2024 12:43:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707425000; cv=pass; d=google.com; s=arc-20160816; b=svxuQcUyAOv9mDM+CRqtsl/ZjU9IAotvsMu73xq+Rjgylv6wVulf0sMT0aJruCoSX/ sLv1iXa6NP0oqJVp0NKuTsPDxvdSlFaVEtltDYy/bkHN1T+77V+7+T5Y4JlGo9nPqVRw jTEXHYMUuEF0iO4StM5Nu2bgAHNt2Qc89H+fimOSgH7l3BXyAH4PmjJh05gKKllO1LaR vG3F+jr3qtfLvl2GCHDEZlGV1yNFTa/m5KtMDOBGjccPF7OBkNgII3b9UEHyfVJWINNk wKKr4HoojNAXhtSCUuCWD6f0LJs15p6PMqNDqj5FNKQfNqK3DXFo/QBimd6za5ifZXA/ t6AA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=fblFAux5V0WUx5L6iQeks/vzBLBqEYo3h4ZSKa3vryQ=; fh=Jtfb73bk3szwnrhLh3+0jwKoVw41zYmKnxeL90vQIPc=; b=PuK0iVFwsC3hl5Ipedl4jSu8oZt9WN+yO+ckNauwUZEhqCgGCh8XsiBbdl8kFDWorz gu3kIULj4rsM6Ro382Vf3v/MJ2zERh83MqvCmkTcjxdBz6eOM3cRBizsrVDhr3EfT7Yz 21w8i5u4b2EdBeq6py4Ocdl3DiwNkbeTORzSrwzH+gK1xWFwIFYv47QZrNeNhtdCL3/l 4hvYWeT6eq1WKd2f8I1LAlEyT7uha+UyJlXbooJ9Vbw1ZZMDHvkYFQXrcsQQlTEhcEwr c7tuKn7VisD9T9LjKE9HIcFXEkqEG3nftXRJCOf3UQqBTAJRvSeRcNzfhYKWoP7HHGeT xSMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nRc+TAnK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCVvUJM7ZwR/nAbjsjpuzhfIk1wluyeQHC7BPcSLWwHuM6+wl67IdISwh8IIIhChYyPri9/qeNS0zX/TUp1JKsplE+c8Fq0z0A7C3uAQ4A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id o29-20020a637e5d000000b005dc50700a54si345330pgn.744.2024.02.08.12.43.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 12:43:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nRc+TAnK; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-58531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 A3516B25E26 for ; Thu, 8 Feb 2024 18:29:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B4138612E; Thu, 8 Feb 2024 18:29:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nRc+TAnK" Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) (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 4B46C85C77; Thu, 8 Feb 2024 18:29:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=134.134.136.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707416968; cv=none; b=tj1c4GAWJKkDU5s7CJgV5l6AMrpcRgK+MewyjcCNDpkM4JhDp4tScsam32a+VSLMfTZHYTB9MDFLcU3qfyo3aClmJXsHmRddUX1w1APxymiU4H+QVFDUuIJcTkAYuLil2jGb0kC2hWIIfy8WQACvf6HiItk+zSeeD/ZVqbsCRJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707416968; c=relaxed/simple; bh=+Mgb9O8JxfiO2LjvLytloVwnGb5SjOO6d7SN0mzNpYo=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=pdg9zGJTZh21QSEOWprCkPAKZh7yidddzhGrBy3Km7nHShv7FXxrGRxtVmcHPwmEGjNbm97/jaYMla2k2iAHAnDRCS3pb1+n76admvZWFOrfYla4oJsZD/kf5aEDcpFsy25x4r7gM1Vu2n1Zp+ELvgknE7/7Nc8XWzswQhQADf8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=nRc+TAnK; arc=none smtp.client-ip=134.134.136.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707416967; x=1738952967; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=+Mgb9O8JxfiO2LjvLytloVwnGb5SjOO6d7SN0mzNpYo=; b=nRc+TAnKfsQRnfRNWfILQg0ohJ6GGIGpbNzsiSFnsq+vqTOxcEDjzf/e YMdRFhDXlPn1d0rd5hB2hGwWpe1elwGhCh3hgTNZUiRGAweisQUH4QEzG ubBQFUC1ZPn9m0MHBkDSexgGKU19QP+QdWuMyP9XNBHmwBPYnwC8Rd7PW DLzQyQZFc4iqTmuoLA56AZlU/BCyGF5fb77MZKdp+Gm/OAX7C7n0Ei+PY IbwSRBAYxS+hPNfxAxWUUtx5yzivVmBYU4NzQjcVlaNH5kcJPSb/Z1o4u 8H9uCl21OxqO8gANj7s+pnGkIu2cefepH9Rwjiv8sJYaBEv32g09u9ijM Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10978"; a="395702300" X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="395702300" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:29:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,254,1701158400"; d="scan'208";a="2099541" Received: from ercutler-mobl.amr.corp.intel.com (HELO [10.209.94.1]) ([10.209.94.1]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2024 10:29:26 -0800 Message-ID: Subject: Re: [PATCH 1/7] fs/writeback: avoid to writeback non-expired inode in kupdate writeback From: Tim Chen To: Kemeng Shi , viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Thu, 08 Feb 2024 10:29:26 -0800 In-Reply-To: <20240208172024.23625-2-shikemeng@huaweicloud.com> References: <20240208172024.23625-1-shikemeng@huaweicloud.com> <20240208172024.23625-2-shikemeng@huaweicloud.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-02-09 at 01:20 +0800, Kemeng Shi wrote: >=20 > =20 > +static void filter_expired_io(struct bdi_writeback *wb) > +{ > + struct inode *inode, *tmp; > + unsigned long expired_jiffies =3D jiffies - > + msecs_to_jiffies(dirty_expire_interval * 10); We have kupdate trigger time hard coded with a factor of 10 to expire inter= val here. The kupdate trigger time "mssecs_to_jiffies(dirty_expire_interval * 10)" is also used in wb_writeback(). It will be better to have a macro or #define to encapsulate the trigger time so if for any reason we need to tune the trigger time, we just need to change it at one place. Tim > + > + spin_lock(&wb->list_lock); > + list_for_each_entry_safe(inode, tmp, &wb->b_io, i_io_list) > + if (inode_dirtied_after(inode, expired_jiffies)) > + redirty_tail(inode, wb); > + > + list_for_each_entry_safe(inode, tmp, &wb->b_more_io, i_io_list) > + if (inode_dirtied_after(inode, expired_jiffies)) > + redirty_tail(inode, wb); > + spin_unlock(&wb->list_lock); > +} > + > /* > * Explicit flushing or periodic writeback of "old" data. > * > @@ -2070,6 +2087,9 @@ static long wb_writeback(struct bdi_writeback *wb, > long progress; > struct blk_plug plug; > =20 > + if (work->for_kupdate) > + filter_expired_io(wb); > + > blk_start_plug(&plug); > for (;;) { > /*