diff mbox series

[f2fs-dev] f2fs: fix thread name cannot be fully displayed

Message ID 1698888042-17199-1-git-send-email-zhiguo.niu@unisoc.com (mailing list archive)
State New
Headers show
Series [f2fs-dev] f2fs: fix thread name cannot be fully displayed | expand

Commit Message

Zhiguo Niu Nov. 2, 2023, 1:20 a.m. UTC
Because the length of task'name in task_struct can not exceed
16 characters, f2fs some thread'name cannot be fully displayed,
including important device number information.
If there are more than one partition using the f2fs file system,
it is very inconvenient to match partitions and their threads.

The following examples show that 4 partitions all use f2fs file system
PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
PID: 510    TASK: ffffff80dd62c9c0  CPU: 0   COMMAND: "f2fs_ckpt-254:4"
PID: 255    TASK: ffffff80f2268000  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
PID: 398    TASK: ffffff80f120ac40  CPU: 2   COMMAND: "f2fs_ckpt-259:4"
PID: 390    TASK: ffffff80f6b76740  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
PID: 511    TASK: ffffff80dd629d80  CPU: 3   COMMAND: "f2fs_flush-254:"
PID: 399    TASK: ffffff80f120bb00  CPU: 2   COMMAND: "f2fs_flush-259:"
PID: 391    TASK: ffffff80f6b70000  CPU: 3   COMMAND: "f2fs_flush-259:"
PID: 256    TASK: ffffff80f226d880  CPU: 6   COMMAND: "f2fs_flush-259:"

We can use the name format such as f2fs_gc-xxx, as saw in device:
PID: 260    TASK: ffffff80f8c2e740  CPU: 3   COMMAND: "f2fs_gc-259:44"
PID: 420    TASK: ffffff80f6505880  CPU: 2   COMMAND: "f2fs_gc-259:41"
PID: 393    TASK: ffffff80f6b72c40  CPU: 1   COMMAND: "f2fs_gc-259:40
PID: 513    TASK: ffffff80dd62e740  CPU: 1   COMMAND: "f2fs_gc-254:40"

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/checkpoint.c | 2 +-
 fs/f2fs/segment.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Chao Yu Nov. 7, 2023, 2:53 p.m. UTC | #1
On 2023/11/2 9:20, Zhiguo Niu wrote:
> Because the length of task'name in task_struct can not exceed
> 16 characters, f2fs some thread'name cannot be fully displayed,
> including important device number information.
> If there are more than one partition using the f2fs file system,
> it is very inconvenient to match partitions and their threads.
> 
> The following examples show that 4 partitions all use f2fs file system
> PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
> PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
> PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
> PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
> PID: 510    TASK: ffffff80dd62c9c0  CPU: 0   COMMAND: "f2fs_ckpt-254:4"
> PID: 255    TASK: ffffff80f2268000  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
> PID: 398    TASK: ffffff80f120ac40  CPU: 2   COMMAND: "f2fs_ckpt-259:4"
> PID: 390    TASK: ffffff80f6b76740  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
> PID: 511    TASK: ffffff80dd629d80  CPU: 3   COMMAND: "f2fs_flush-254:"
> PID: 399    TASK: ffffff80f120bb00  CPU: 2   COMMAND: "f2fs_flush-259:"
> PID: 391    TASK: ffffff80f6b70000  CPU: 3   COMMAND: "f2fs_flush-259:"
> PID: 256    TASK: ffffff80f226d880  CPU: 6   COMMAND: "f2fs_flush-259:"
> 
> We can use the name format such as f2fs_gc-xxx, as saw in device:
> PID: 260    TASK: ffffff80f8c2e740  CPU: 3   COMMAND: "f2fs_gc-259:44"
> PID: 420    TASK: ffffff80f6505880  CPU: 2   COMMAND: "f2fs_gc-259:41"
> PID: 393    TASK: ffffff80f6b72c40  CPU: 1   COMMAND: "f2fs_gc-259:40
> PID: 513    TASK: ffffff80dd62e740  CPU: 1   COMMAND: "f2fs_gc-254:40"

Can you please check comments in below link?

https://lore.kernel.org/linux-f2fs-devel/8eaad9d0-1d59-3ecb-bab4-904ed22385f4@kernel.org/

Thanks,

> 
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
>   fs/f2fs/checkpoint.c | 2 +-
>   fs/f2fs/segment.c    | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index b0597a5..f6a5424 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -1893,7 +1893,7 @@ int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
>   		return 0;
>   
>   	cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
> -			"f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
> +			"f2fs_cp-%u:%u", MAJOR(dev), MINOR(dev));
>   	if (IS_ERR(cprc->f2fs_issue_ckpt)) {
>   		int err = PTR_ERR(cprc->f2fs_issue_ckpt);
>   
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index d05b416..b290713 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -677,7 +677,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
>   
>   init_thread:
>   	fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
> -				"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
> +				"f2fs_fh-%u:%u", MAJOR(dev), MINOR(dev));
>   	if (IS_ERR(fcc->f2fs_issue_flush)) {
>   		int err = PTR_ERR(fcc->f2fs_issue_flush);
>   
> @@ -2248,7 +2248,7 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi)
>   		return 0;
>   
>   	dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi,
> -				"f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
> +				"f2fs_dc-%u:%u", MAJOR(dev), MINOR(dev));
>   	if (IS_ERR(dcc->f2fs_issue_discard)) {
>   		err = PTR_ERR(dcc->f2fs_issue_discard);
>   		dcc->f2fs_issue_discard = NULL;
Zhiguo Niu Nov. 8, 2023, 2:46 a.m. UTC | #2
Dear Chao,

On Tue, Nov 7, 2023 at 10:53 PM Chao Yu <chao@kernel.org> wrote:
>
> On 2023/11/2 9:20, Zhiguo Niu wrote:
> > Because the length of task'name in task_struct can not exceed
> > 16 characters, f2fs some thread'name cannot be fully displayed,
> > including important device number information.
> > If there are more than one partition using the f2fs file system,
> > it is very inconvenient to match partitions and their threads.
> >
> > The following examples show that 4 partitions all use f2fs file system
> > PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
> > PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
> > PID: 400    TASK: ffffff80f120c9c0  CPU: 2   COMMAND: "f2fs_discard-25"
> > PID: 392    TASK: ffffff80f6b75880  CPU: 3   COMMAND: "f2fs_discard-25"
> > PID: 510    TASK: ffffff80dd62c9c0  CPU: 0   COMMAND: "f2fs_ckpt-254:4"
> > PID: 255    TASK: ffffff80f2268000  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
> > PID: 398    TASK: ffffff80f120ac40  CPU: 2   COMMAND: "f2fs_ckpt-259:4"
> > PID: 390    TASK: ffffff80f6b76740  CPU: 3   COMMAND: "f2fs_ckpt-259:4"
> > PID: 511    TASK: ffffff80dd629d80  CPU: 3   COMMAND: "f2fs_flush-254:"
> > PID: 399    TASK: ffffff80f120bb00  CPU: 2   COMMAND: "f2fs_flush-259:"
> > PID: 391    TASK: ffffff80f6b70000  CPU: 3   COMMAND: "f2fs_flush-259:"
> > PID: 256    TASK: ffffff80f226d880  CPU: 6   COMMAND: "f2fs_flush-259:"
> >
> > We can use the name format such as f2fs_gc-xxx, as saw in device:
> > PID: 260    TASK: ffffff80f8c2e740  CPU: 3   COMMAND: "f2fs_gc-259:44"
> > PID: 420    TASK: ffffff80f6505880  CPU: 2   COMMAND: "f2fs_gc-259:41"
> > PID: 393    TASK: ffffff80f6b72c40  CPU: 1   COMMAND: "f2fs_gc-259:40
> > PID: 513    TASK: ffffff80dd62e740  CPU: 1   COMMAND: "f2fs_gc-254:40"
>
> Can you please check comments in below link?
>
> https://lore.kernel.org/linux-f2fs-devel/8eaad9d0-1d59-3ecb-bab4-904ed22385f4@kernel.org/
>
Thanks for your share and I got it.
> Thanks,
>
> >
> > Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> > ---
> >   fs/f2fs/checkpoint.c | 2 +-
> >   fs/f2fs/segment.c    | 4 ++--
> >   2 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> > index b0597a5..f6a5424 100644
> > --- a/fs/f2fs/checkpoint.c
> > +++ b/fs/f2fs/checkpoint.c
> > @@ -1893,7 +1893,7 @@ int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
> >               return 0;
> >
> >       cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
> > -                     "f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
> > +                     "f2fs_cp-%u:%u", MAJOR(dev), MINOR(dev));
> >       if (IS_ERR(cprc->f2fs_issue_ckpt)) {
> >               int err = PTR_ERR(cprc->f2fs_issue_ckpt);
> >
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index d05b416..b290713 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -677,7 +677,7 @@ int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
> >
> >   init_thread:
> >       fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
> > -                             "f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
> > +                             "f2fs_fh-%u:%u", MAJOR(dev), MINOR(dev));
> >       if (IS_ERR(fcc->f2fs_issue_flush)) {
> >               int err = PTR_ERR(fcc->f2fs_issue_flush);
> >
> > @@ -2248,7 +2248,7 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi)
> >               return 0;
> >
> >       dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi,
> > -                             "f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
> > +                             "f2fs_dc-%u:%u", MAJOR(dev), MINOR(dev));
> >       if (IS_ERR(dcc->f2fs_issue_discard)) {
> >               err = PTR_ERR(dcc->f2fs_issue_discard);
> >               dcc->f2fs_issue_discard = NULL;
diff mbox series

Patch

diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index b0597a5..f6a5424 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1893,7 +1893,7 @@  int f2fs_start_ckpt_thread(struct f2fs_sb_info *sbi)
 		return 0;
 
 	cprc->f2fs_issue_ckpt = kthread_run(issue_checkpoint_thread, sbi,
-			"f2fs_ckpt-%u:%u", MAJOR(dev), MINOR(dev));
+			"f2fs_cp-%u:%u", MAJOR(dev), MINOR(dev));
 	if (IS_ERR(cprc->f2fs_issue_ckpt)) {
 		int err = PTR_ERR(cprc->f2fs_issue_ckpt);
 
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index d05b416..b290713 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -677,7 +677,7 @@  int f2fs_create_flush_cmd_control(struct f2fs_sb_info *sbi)
 
 init_thread:
 	fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
-				"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
+				"f2fs_fh-%u:%u", MAJOR(dev), MINOR(dev));
 	if (IS_ERR(fcc->f2fs_issue_flush)) {
 		int err = PTR_ERR(fcc->f2fs_issue_flush);
 
@@ -2248,7 +2248,7 @@  int f2fs_start_discard_thread(struct f2fs_sb_info *sbi)
 		return 0;
 
 	dcc->f2fs_issue_discard = kthread_run(issue_discard_thread, sbi,
-				"f2fs_discard-%u:%u", MAJOR(dev), MINOR(dev));
+				"f2fs_dc-%u:%u", MAJOR(dev), MINOR(dev));
 	if (IS_ERR(dcc->f2fs_issue_discard)) {
 		err = PTR_ERR(dcc->f2fs_issue_discard);
 		dcc->f2fs_issue_discard = NULL;