Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp461357rdb; Sat, 17 Feb 2024 18:02:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9zWiq0dfTt0YIyFyTDs/WVJfUiRmhr+2zcAfSfpumi69GanKRuIhEuJNcTwdambCFIxDnYLQdxOieams0AasQznjb4STwIlj6wU2cWA== X-Google-Smtp-Source: AGHT+IFvrGhm+BhiY6jLKBl/G7JE79BlkWD6a7SE3EyOOReinArp+rVatN03kKZyVOTNseJxG8/M X-Received: by 2002:a05:6808:bd4:b0:3c1:559b:4290 with SMTP id o20-20020a0568080bd400b003c1559b4290mr207476oik.42.1708221747474; Sat, 17 Feb 2024 18:02:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708221747; cv=pass; d=google.com; s=arc-20160816; b=eJ7ctUMykH6+8B2So/EymDjDXWOC9KBBMsHavlqcHdUEelkZZTwepEg12Q2B/EDIxv 21HEbeCd0y/xIvsTt1VCMw5R2Q8nG7yF7vl9p40XJxXvwAhSV04DfoIULmDAIr/xYHF6 91T1rtVm+7MBTw4i+1qRs6aJc8qlFnodH3E1GimbY+D5gLgR70PdY/FmlSPeebpFW9F7 Dtls+bU/L/OtZErrBATEyKuWtpNWYL/aKOzyXnyvdWpDAn0kd98tBtZKLzRPI9HesNQc daklGmZmuGhDrSRtRLs4qIq/xvlcfjFZmQ8K52tObqMYTSjVh/cu1E6Uv1sSsZvjH29+ x5Rg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=HXaXTBRzE05Zu2Qr0Emqt8wQJvb6EQLXEoEBw/y/laU=; fh=snXmzSMKyyW/OP1KaM2PppFnHaSnLM2IYKXcvxNZNog=; b=xyP54FZjGAms9p3SMA1gz9+UWFh+euMEZeBIOJWZV84L1DhS71kkcUuXupL3SVSzyk cAkzbHSVnV4jdyBS50hCXhoy58wPJXuVWXMZFDOPqlv7vu+gY/WILdW/LLi4v8TWYVkb Sf1Fwxu7FLivA2mjVqg1M8idMrB6OsNdkWXTJINSzapy8OG3270cN5ZRrWmhk5Ysa3LW zYBsIH2aMS54GfAyHAouO+0sOZQDyyMz+AibbY9BVV06qT0LY9jDz6RHzS+fI9Zl/2NL KiOWuiukh5okgD/t/l1uUF/vpw224EoLjA5bun2zMlPVIdP5BkkNUdoo7RFMW9v5HB6u SwOw==; 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-70144-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70144-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bd10-20020a056a00278a00b006dde1514009si2263293pfb.132.2024.02.17.18.02.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 18:02:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70144-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; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-70144-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70144-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 D32ADB215A8 for ; Sun, 18 Feb 2024 02:02:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A42615D0; Sun, 18 Feb 2024 02:02:11 +0000 (UTC) Received: from dggsgout12.his.huawei.com (unknown [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 7A8ABA29; Sun, 18 Feb 2024 02:02:08 +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=1708221730; cv=none; b=nlxInXPoU1a60lAGTyX2gChz7yMbACfRtrEhGsfB6f2wyVmmJrPt+zMj6G2p0ojVs1t7bXy5P/IKd2EAZIRGZcv0RJRTracJ6Ca4CRg6fv90dExLqGEharOUFXjhIdpkxaEYnWWuWvMlECV/5pXdNDYNrFmeyivoDSDq14c7CIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708221730; c=relaxed/simple; bh=4lXEcH1qeiznkTANiY2C31x6lg4OWCCcZv+EalwqFCs=; h=Subject:To:Cc:References:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=nVy+X0PaYOLTZKmWikyLHKL6lNCcTYH0SI+qnV8OGBPlVIjfHBvjxPbrQ+fRlDhnaEkk/oc6q9mv9GeKgc3IqbMAIW3gzb6AohLtT73fepHDQxoQRa6T/0VoNwppWB0VvXVW15TGMk2h4tvyIAqOW8j4HIuV92ZT/oC28+0v1yg= 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 4Tcpng0SkYz4f3jrp; Sun, 18 Feb 2024 10:01:59 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id E1D311A0175; Sun, 18 Feb 2024 10:02:03 +0800 (CST) Received: from [10.174.178.129] (unknown [10.174.178.129]) by APP1 (Coremail) with SMTP id cCh0CgC3iBEGZdFluRRoEQ--.27970S2; Sun, 18 Feb 2024 10:01:58 +0800 (CST) Subject: Re: [PATCH 1/7] fs/writeback: avoid to writeback non-expired inode in kupdate writeback To: Tim Chen , viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240208172024.23625-1-shikemeng@huaweicloud.com> <20240208172024.23625-2-shikemeng@huaweicloud.com> From: Kemeng Shi Message-ID: <4364e9bc-2d29-120d-4837-7f5620585508@huaweicloud.com> Date: Sun, 18 Feb 2024 10:01:42 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CM-TRANSID:cCh0CgC3iBEGZdFluRRoEQ--.27970S2 X-Coremail-Antispam: 1UD129KBjvJXoW7WFyruryDtw4DZrW8GF4UJwb_yoW8XFyfpF WrKFyUtF48Za40gr4vy3W7ZrsIqF48Gr13J3WjkF17tas8ZFnagFy8WrWfG3W0yr4aqwsY va18J347Cw4UKaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyEb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcVAKI48JMxk0xIA0c2IEe2xFo4CEbIxvr21l42xK82IYc2Ij 64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x 8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE 2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42 xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIE c7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1zuWJUUUUU== X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ on 2/9/2024 2:29 AM, Tim Chen wrote: > On Fri, 2024-02-09 at 01:20 +0800, Kemeng Shi wrote: >> >> >> +static void filter_expired_io(struct bdi_writeback *wb) >> +{ >> + struct inode *inode, *tmp; >> + unsigned long expired_jiffies = jiffies - >> + msecs_to_jiffies(dirty_expire_interval * 10); > > We have kupdate trigger time hard coded with a factor of 10 to expire interval 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. Hi Tim. Sorry for the late reply, I was on vacation these days. I agree it's better to have a macro and I will add it in next version. Thanks! > > 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; >> >> + if (work->for_kupdate) >> + filter_expired_io(wb); >> + >> blk_start_plug(&plug); >> for (;;) { >> /* >