All of lore.kernel.org
 help / color / mirror / Atom feed
From: "yohan.joung@sk.com" <yohan.joung@sk.com>
To: Chao Yu <chao@kernel.org>, Yohan Joung <jyh429@gmail.com>,
	"jaegeuk@kernel.org" <jaegeuk@kernel.org>,
	"daeho43@gmail.com" <daeho43@gmail.com>
Cc: "pilhyun.kim@sk.com" <pilhyun.kim@sk.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-f2fs-devel@lists.sourceforge.net"
	<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] [External Mail] Re: [PATCH] f2fs: prevent the current section from being selected as a victim during garbage collection
Date: Thu, 27 Mar 2025 06:43:50 +0000	[thread overview]
Message-ID: <2d95428375bd4a5592516bb6cefe4592@sk.com> (raw)
In-Reply-To: <bf3f571c-a6bf-4a17-8745-039b37ac4f48@kernel.org>

> From: Chao Yu <chao@kernel.org>
> Sent: Thursday, March 27, 2025 3:02 PM
> To: Yohan Joung <jyh429@gmail.com>; jaegeuk@kernel.org; daeho43@gmail.com
> Cc: chao@kernel.org; linux-f2fs-devel@lists.sourceforge.net; linux-
> kernel@vger.kernel.org; 정요한(JOUNG YOHAN) Mobile AE <yohan.joung@sk.com>
> Subject: [External Mail] Re: [PATCH] f2fs: prevent the current section
> from being selected as a victim during garbage collection
> 
> On 3/26/25 22:14, Yohan Joung wrote:
> > When selecting a victim using next_victim_seg in a large section, the
> > selected section might already have been cleared and designated as the
> > new current section, making it actively in use.
> > This behavior causes inconsistency between the SIT and SSA.
> 
> Hi, does this fix your issue?

This is an issue that arises when dividing 
a large section into segments for garbage collection.
caused by the background GC (garbage collection) thread in large section
f2fs_gc(victim_section) -> f2fs_clear_prefree_segments(victim_section)-> 
cursec(victim_section) -> f2fs_gc(victim_section by next_victim_seg)

Because the call stack is different, 
I think that in order to handle everything at once, 
we need to address it within do_garbage_collect, 
or otherwise include it on both sides. What do you think?

[30146.337471][ T1300] F2FS-fs (dm-54): Inconsistent segment (70961) type [0, 1] in SSA and SIT
[30146.346151][ T1300] Call trace:
[30146.346152][ T1300]  dump_backtrace+0xe8/0x10c
[30146.346157][ T1300]  show_stack+0x18/0x28
[30146.346158][ T1300]  dump_stack_lvl+0x50/0x6c
[30146.346161][ T1300]  dump_stack+0x18/0x28
[30146.346162][ T1300]  f2fs_stop_checkpoint+0x1c/0x3c
[30146.346165][ T1300]  do_garbage_collect+0x41c/0x271c
[30146.346167][ T1300]  f2fs_gc+0x27c/0x828
[30146.346168][ T1300]  gc_thread_func+0x290/0x88c
[30146.346169][ T1300]  kthread+0x11c/0x164
[30146.346172][ T1300]  ret_from_fork+0x10/0x20

struct curseg_info : 0xffffff803f95e800 {
	segno        : 0x11531 : 70961
}

struct f2fs_sb_info : 0xffffff8811d12000 {
	next_victim_seg[0] : 0x11531 : 70961
}

> 
> https://lore.kernel.org/linux-f2fs-devel/20250325080646.3291947-2-
> chao@kernel.org
> 
> Thanks,
> 
> >
> > Signed-off-by: Yohan Joung <yohan.joung@sk.com>
> > ---
> >  fs/f2fs/gc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index
> > 2b8f9239bede..4b5d18e395eb 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -1926,6 +1926,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct
> f2fs_gc_control *gc_control)
> >  		goto stop;
> >  	}
> >
> > +	if (__is_large_section(sbi) &&
> > +			IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, segno)))
> > +		goto stop;
> > +
> >  	seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type,
> >  				gc_control->should_migrate_blocks,
> >  				gc_control->one_time);


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: "정요한(JOUNG YOHAN) Mobile AE" <yohan.joung@sk.com>
To: Chao Yu <chao@kernel.org>, Yohan Joung <jyh429@gmail.com>,
	"jaegeuk@kernel.org" <jaegeuk@kernel.org>,
	"daeho43@gmail.com" <daeho43@gmail.com>
Cc: "linux-f2fs-devel@lists.sourceforge.net"
	<linux-f2fs-devel@lists.sourceforge.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"김필현(KIM PILHYUN) Mobile AE" <pilhyun.kim@sk.com>
Subject: RE: [External Mail] Re: [PATCH] f2fs: prevent the current section from being selected as a victim during garbage collection
Date: Thu, 27 Mar 2025 06:43:50 +0000	[thread overview]
Message-ID: <2d95428375bd4a5592516bb6cefe4592@sk.com> (raw)
In-Reply-To: <bf3f571c-a6bf-4a17-8745-039b37ac4f48@kernel.org>

> From: Chao Yu <chao@kernel.org>
> Sent: Thursday, March 27, 2025 3:02 PM
> To: Yohan Joung <jyh429@gmail.com>; jaegeuk@kernel.org; daeho43@gmail.com
> Cc: chao@kernel.org; linux-f2fs-devel@lists.sourceforge.net; linux-
> kernel@vger.kernel.org; 정요한(JOUNG YOHAN) Mobile AE <yohan.joung@sk.com>
> Subject: [External Mail] Re: [PATCH] f2fs: prevent the current section
> from being selected as a victim during garbage collection
> 
> On 3/26/25 22:14, Yohan Joung wrote:
> > When selecting a victim using next_victim_seg in a large section, the
> > selected section might already have been cleared and designated as the
> > new current section, making it actively in use.
> > This behavior causes inconsistency between the SIT and SSA.
> 
> Hi, does this fix your issue?

This is an issue that arises when dividing 
a large section into segments for garbage collection.
caused by the background GC (garbage collection) thread in large section
f2fs_gc(victim_section) -> f2fs_clear_prefree_segments(victim_section)-> 
cursec(victim_section) -> f2fs_gc(victim_section by next_victim_seg)

Because the call stack is different, 
I think that in order to handle everything at once, 
we need to address it within do_garbage_collect, 
or otherwise include it on both sides. What do you think?

[30146.337471][ T1300] F2FS-fs (dm-54): Inconsistent segment (70961) type [0, 1] in SSA and SIT
[30146.346151][ T1300] Call trace:
[30146.346152][ T1300]  dump_backtrace+0xe8/0x10c
[30146.346157][ T1300]  show_stack+0x18/0x28
[30146.346158][ T1300]  dump_stack_lvl+0x50/0x6c
[30146.346161][ T1300]  dump_stack+0x18/0x28
[30146.346162][ T1300]  f2fs_stop_checkpoint+0x1c/0x3c
[30146.346165][ T1300]  do_garbage_collect+0x41c/0x271c
[30146.346167][ T1300]  f2fs_gc+0x27c/0x828
[30146.346168][ T1300]  gc_thread_func+0x290/0x88c
[30146.346169][ T1300]  kthread+0x11c/0x164
[30146.346172][ T1300]  ret_from_fork+0x10/0x20

struct curseg_info : 0xffffff803f95e800 {
	segno        : 0x11531 : 70961
}

struct f2fs_sb_info : 0xffffff8811d12000 {
	next_victim_seg[0] : 0x11531 : 70961
}

> 
> https://lore.kernel.org/linux-f2fs-devel/20250325080646.3291947-2-
> chao@kernel.org
> 
> Thanks,
> 
> >
> > Signed-off-by: Yohan Joung <yohan.joung@sk.com>
> > ---
> >  fs/f2fs/gc.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index
> > 2b8f9239bede..4b5d18e395eb 100644
> > --- a/fs/f2fs/gc.c
> > +++ b/fs/f2fs/gc.c
> > @@ -1926,6 +1926,10 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct
> f2fs_gc_control *gc_control)
> >  		goto stop;
> >  	}
> >
> > +	if (__is_large_section(sbi) &&
> > +			IS_CURSEC(sbi, GET_SEC_FROM_SEG(sbi, segno)))
> > +		goto stop;
> > +
> >  	seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type,
> >  				gc_control->should_migrate_blocks,
> >  				gc_control->one_time);


  reply	other threads:[~2025-03-27  6:44 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 14:14 [f2fs-dev] [PATCH] f2fs: prevent the current section from being selected as a victim during garbage collection Yohan Joung
2025-03-26 14:14 ` Yohan Joung
2025-03-27  6:02 ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-03-27  6:02   ` Chao Yu
2025-03-27  6:43   ` yohan.joung [this message]
2025-03-27  6:43     ` [External Mail] " 정요한(JOUNG YOHAN) Mobile AE
2025-03-27  7:29     ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-03-27  7:29       ` Chao Yu
2025-03-27  8:00       ` [f2fs-dev] [External Mail] " yohan.joung
2025-03-27  8:00         ` 정요한(JOUNG YOHAN) Mobile AE
2025-03-27 13:47         ` [f2fs-dev] " Chao Yu via Linux-f2fs-devel
2025-03-27 13:47           ` Chao Yu
2025-03-28  3:40           ` [f2fs-dev] " yohan.joung
2025-03-28  3:40             ` yohan.joung
2025-03-28  6:17             ` Chao Yu via Linux-f2fs-devel
2025-03-28  6:17               ` Chao Yu
2025-03-28  7:25               ` [f2fs-dev] [External Mail] " yohan.joung
2025-03-28  7:25                 ` [External Mail] Re: [f2fs-dev] " yohan.joung
2025-03-28  8:00                 ` [f2fs-dev] [External Mail] " Chao Yu via Linux-f2fs-devel
2025-03-28  8:00                   ` [External Mail] Re: [f2fs-dev] " Chao Yu
2025-03-31  5:13                   ` [f2fs-dev] [External Mail] " yohan.joung
2025-03-31  5:13                     ` [External Mail] Re: [f2fs-dev] " yohan.joung
2025-03-31 11:36                     ` [f2fs-dev] [External Mail] " Chao Yu via Linux-f2fs-devel
2025-03-31 11:36                       ` [External Mail] Re: [f2fs-dev] " Chao Yu
2025-04-01  1:51                   ` [f2fs-dev] [External Mail] " yohan.joung
2025-04-01  1:51                     ` [External Mail] Re: [f2fs-dev] " yohan.joung
2025-04-01  5:41                     ` [f2fs-dev] [External Mail] " Chao Yu via Linux-f2fs-devel
2025-04-01  5:41                       ` [External Mail] Re: [f2fs-dev] " Chao Yu
2025-04-01  7:47                       ` [f2fs-dev] [External Mail] " yohan.joung
2025-04-01  7:47                         ` [External Mail] Re: [f2fs-dev] " yohan.joung
2025-04-01  8:44                         ` [f2fs-dev] [External Mail] " Chao Yu via Linux-f2fs-devel
2025-04-01  8:44                           ` [External Mail] Re: [f2fs-dev] " Chao Yu
2025-04-02  0:33                           ` [f2fs-dev] [External Mail] " yohan.joung
2025-04-02  0:33                             ` [External Mail] Re: [f2fs-dev] " yohan.joung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d95428375bd4a5592516bb6cefe4592@sk.com \
    --to=yohan.joung@sk.com \
    --cc=chao@kernel.org \
    --cc=daeho43@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=jyh429@gmail.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pilhyun.kim@sk.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.