From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C19FC433FF for ; Mon, 29 Jul 2019 16:01:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 67A47217D4 for ; Mon, 29 Jul 2019 16:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564416068; bh=zsjK32URpw9E8xLWXuq6yO1piXT5U7FJRiPetxczkY8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-ID:From; b=tpufXZKZq8RzII9kaKAIy0pb2mY6L4RZggZApQ92GHiwFat5XyKoavSZk5PUNBOs5 CE7vFq+C8GQ1qDR38CK2WjtPISkaDsY/5olS50kAOz2Pl+W91zlzajdc8TmRytwpIV o5mpdEVcZHU9e/BRyyWYhjN5ibASzHVzLmCSpzRw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727488AbfG2QBH (ORCPT ); Mon, 29 Jul 2019 12:01:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:56810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbfG2QBG (ORCPT ); Mon, 29 Jul 2019 12:01:06 -0400 Received: from [192.168.0.101] (unknown [180.111.32.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEDE121773; Mon, 29 Jul 2019 16:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564416065; bh=zsjK32URpw9E8xLWXuq6yO1piXT5U7FJRiPetxczkY8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=o8LQ/PbTkEysPkQh7s5MVgRkrgiRvXMDYlm8omA3B0CBInsniNIHXTNJ2PZJsNi1Z JueR51t44xI69CjyVNWrfVCorx+hK+Dn0qG5uc666cyg8aS3049O10gSFQDYEdpotu owo+G2PTA73CG0Z0jbYWREIAYkSdj950MAFQl9b0= Subject: Re: [f2fs-dev] [PATCH] f2fs: Fix indefinite loop in f2fs_gc() To: Sahitya Tummala , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org References: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> From: Chao Yu Message-ID: Date: Tue, 30 Jul 2019 00:00:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sahitya, On 2019-7-29 13:20, Sahitya Tummala wrote: > Policy - foreground GC, LFS mode and greedy GC mode. > > Under this policy, f2fs_gc() loops forever to GC as it doesn't have > enough free segements to proceed and thus it keeps calling gc_more > for the same victim segment. This can happen if the selected victim > segment could not be GC'd due to failed blkaddr validity check i.e. > is_alive() returns false for the blocks set in current validity map. > > Fix this by not resetting the sbi->cur_victim_sec to NULL_SEGNO, when > the segment selected could not be GC'd. This helps to select another > segment for GC and thus helps to proceed forward with GC. > > Signed-off-by: Sahitya Tummala > --- > fs/f2fs/gc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 8974672..7bbcc4a 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1303,7 +1303,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, > round++; > } > > - if (gc_type == FG_GC) > + if (gc_type == FG_GC && seg_freed) > sbi->cur_victim_sec = NULL_SEGNO; In some cases, we may remain last victim in sbi->cur_victim_sec, and jump out of GC cycle, then SSR can skip the last victim due to sec_usage_check()... Thanks, > > if (sync) > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E851DC7618B for ; Mon, 29 Jul 2019 16:01:16 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B517921773; Mon, 29 Jul 2019 16:01:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="C0HkGddT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="ElIJg2G9"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="o8LQ/PbT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B517921773 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hs85M-00018T-6J; Mon, 29 Jul 2019 16:01:16 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hs85K-00018M-RG for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jul 2019 16:01:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XKHXPDxRecsQtRl+aiRsfHYdNoifPh6ZP5S7KkpQm0A=; b=C0HkGddTAfjmykzmpOf/Sz1tIp /hcXeMGRRAq5V5/LT0PvBPedhO0TBx9cn/k/+fIF4lXL2ywX8vahykgfzq7r2QOINBoWAbAnWH9lS VVn/c2Bkr6kNv410n8oHGw8dg2FxMiVmm8d/qTBO/ogrG4ozEpiw6ftqSQT3YKUAN0CA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=XKHXPDxRecsQtRl+aiRsfHYdNoifPh6ZP5S7KkpQm0A=; b=ElIJg2G9mTMFAMRPSqDHb5xmFC 5dd4ydSakyLk+obtcrJ4UgWZb4aXTVzSFZYYvR0wCmXRXrnbWtmuxzVM+fEK9XBEhO5ooTnSC5xpI OWBvzUlD5sh/pAEtqTar4iVDSajouPwzlz63cSAaBdD+uHRahJrZyRhtVsVy/XplcZyE=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hs85J-003die-MP for linux-f2fs-devel@lists.sourceforge.net; Mon, 29 Jul 2019 16:01:14 +0000 Received: from [192.168.0.101] (unknown [180.111.32.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEDE121773; Mon, 29 Jul 2019 16:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564416065; bh=zsjK32URpw9E8xLWXuq6yO1piXT5U7FJRiPetxczkY8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=o8LQ/PbTkEysPkQh7s5MVgRkrgiRvXMDYlm8omA3B0CBInsniNIHXTNJ2PZJsNi1Z JueR51t44xI69CjyVNWrfVCorx+hK+Dn0qG5uc666cyg8aS3049O10gSFQDYEdpotu owo+G2PTA73CG0Z0jbYWREIAYkSdj950MAFQl9b0= To: Sahitya Tummala , Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net References: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> From: Chao Yu Message-ID: Date: Tue, 30 Jul 2019 00:00:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1564377626-12898-1-git-send-email-stummala@codeaurora.org> Content-Language: en-US X-Headers-End: 1hs85J-003die-MP Subject: Re: [f2fs-dev] [PATCH] f2fs: Fix indefinite loop in f2fs_gc() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Hi Sahitya, On 2019-7-29 13:20, Sahitya Tummala wrote: > Policy - foreground GC, LFS mode and greedy GC mode. > > Under this policy, f2fs_gc() loops forever to GC as it doesn't have > enough free segements to proceed and thus it keeps calling gc_more > for the same victim segment. This can happen if the selected victim > segment could not be GC'd due to failed blkaddr validity check i.e. > is_alive() returns false for the blocks set in current validity map. > > Fix this by not resetting the sbi->cur_victim_sec to NULL_SEGNO, when > the segment selected could not be GC'd. This helps to select another > segment for GC and thus helps to proceed forward with GC. > > Signed-off-by: Sahitya Tummala > --- > fs/f2fs/gc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 8974672..7bbcc4a 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -1303,7 +1303,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync, > round++; > } > > - if (gc_type == FG_GC) > + if (gc_type == FG_GC && seg_freed) > sbi->cur_victim_sec = NULL_SEGNO; In some cases, we may remain last victim in sbi->cur_victim_sec, and jump out of GC cycle, then SSR can skip the last victim due to sec_usage_check()... Thanks, > > if (sync) > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel