Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4661215imm; Mon, 15 Oct 2018 20:11:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV60iFPGjdLoQur+nIjS4B8jyEtBt8+Lw71SUxocoWp7xrzUyPbWh+ZPZFsJ9FWKnCPRHEi2Z X-Received: by 2002:a62:4681:: with SMTP id o1-v6mr20103202pfi.108.1539659507436; Mon, 15 Oct 2018 20:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539659507; cv=none; d=google.com; s=arc-20160816; b=Y9nnK89r+bKYRveiQKglyKwWu5v2nvS7vOmsfhODVtPbhofP/XHrU7m8Yw7/AB0Lrm oRG5gumo/EI7LsA4NiNWsX/Q/G2FDSEWOjmgHjvIDcH/TTcxKcfxxg0lL/34iV/8FXCC cn6EbkRCnuHrbHvN5GgAaZ5LJXxKihgGW+TGfX+oVf03jBFgkmq3eP+CGFrW7VMUYS7S EsJ/d4MW7snIHqEbHwjwgzMcXt18KZrgLgzDLk/ZLY0mQkfFNTIgUWQt+8PVFuIfuIFQ b6zPZk4WDYant8xbCKndnYlZHsu1bvM8BJKFhQu0HyDiIfu+S/CKUBAqoFdnwwmZU6XA H0YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OP0SnNZ33vyWXFQtSiRA5aKZbRzrzPC+k2v7twAvzEA=; b=GkRsXPFWPRWvd8Ll6q2ZxAkqfpa+76M5e0p+LtTMddZSMX9ZpwP96Hvk4+rtx6lVH4 hRXsbKf+BEaIInJbpF59K00CeK+M9zm1RHCNy5R9wca7KtfsRKrUD2zo5xQzr8qtfdm2 X2QeqF+SmpN96T356AFC8Tvny6PM/0xalhoFPEs4AWxCUhbaEF8c1wfWT8NOxre52Rox 6EU7tKdaBj9iHZ2tkbdTQZ0bKSVQYarIJhYA925om9+wOELAY669402P3NTEi6KxiiHv j3WhtnCcxKYzg8zntuZZ5y9BN8kah1xCEeWoDzi5k30/4iFI89FYsi8p+y6Ok6/QtTcH YKJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N9YiBh1d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si608plv.207.2018.10.15.20.11.30; Mon, 15 Oct 2018 20:11:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N9YiBh1d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727266AbeJPK7E (ORCPT + 99 others); Tue, 16 Oct 2018 06:59:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:34188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727110AbeJPK7D (ORCPT ); Tue, 16 Oct 2018 06:59:03 -0400 Received: from localhost (unknown [104.132.1.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 21D44208D9; Tue, 16 Oct 2018 03:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539659453; bh=E/iZ0FmyrEqaF37xXTNS/sY376KEPJAx5XaAkCClr/U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N9YiBh1dvgc0j0vt0KcvXfhZOKW88LqMOHYkm12+uiRHspeUKqyCbPikdPzO07A/E DpGA32xcQVlk6Z/ESt7uGwA6Ox5q4FqD7H7Nhk4VtqKZMYDxQIbOkNk+xoQKGJAgjn GLCzUtYSgUp3aXB0Lv+MHDcJF5zCb0g3Cu7cYo6U= Date: Mon, 15 Oct 2018 20:10:52 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] [PATCH] f2fs: clear cold data flag if IO is not counted Message-ID: <20181016031052.GA19956@jaegeuk-macbookpro.roam.corp.google.com> References: <20181010212217.52289-1-jaegeuk@kernel.org> <3f08031e-d195-5bc1-67e1-f3b6eab3506b@huawei.com> <20181015230807.GC1296@jaegeuk-macbookpro.roam.corp.google.com> <405b1521-cbfb-9f09-0d16-ae837b756cbb@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <405b1521-cbfb-9f09-0d16-ae837b756cbb@huawei.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/16, Chao Yu wrote: > On 2018/10/16 7:08, Jaegeuk Kim wrote: > > On 10/15, Chao Yu wrote: > >> On 2018/10/11 5:22, Jaegeuk Kim wrote: > >>> If we clear the cold data flag out of the writeback flow, we can miscount > >>> -1 by end_io. > >> > >> I didn't get it, which count do you mean? > > > > It's the number of dirty pages. > > > > Balancing F2FS Async: > > - IO (CP: 1, Data: -1, Flush: ( 0 0 1), Discard: ( 0 129304)) cmd: 0 undiscard: 0 > > > > So I guess the race should be: > > GC thread: IRQ > - move_data_page() > - set_page_dirty() > - clear_cold_data() > - f2fs_write_end_io() > - type = WB_DATA_TYPE(page); > here, we get wrong type > - dec_page_count(sbi, type); > - f2fs_wait_on_page_writeback() > > How about relocate wait_writeback & set_page_dirty to avoid above race: Well, wait_on_stable_page() doesn't guarantee its end_io. So, I'm not sure this is the only case. > > move_data_page() > > retry: > f2fs_wait_on_page_writeback(page, DATA, true); > set_page_dirty(page); > > Thanks, > > >> > >> Thanks, > >> > >>> > >>> Signed-off-by: Jaegeuk Kim > >>> --- > >>> fs/f2fs/data.c | 4 ---- > >>> 1 file changed, 4 deletions(-) > >>> > >>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > >>> index 29a9d3b8f709..4102799b5558 100644 > >>> --- a/fs/f2fs/data.c > >>> +++ b/fs/f2fs/data.c > >>> @@ -2636,10 +2636,6 @@ static int f2fs_set_data_page_dirty(struct page *page) > >>> if (!PageUptodate(page)) > >>> SetPageUptodate(page); > >>> > >>> - /* don't remain PG_checked flag which was set during GC */ > >>> - if (is_cold_data(page)) > >>> - clear_cold_data(page); > >>> - > >>> if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) { > >>> if (!IS_ATOMIC_WRITTEN_PAGE(page)) { > >>> f2fs_register_inmem_page(inode, page); > >>> > > > > . > >