Skip to contentSkip to conversation

kernel/hung_task.c: Fix a typo in check_hung_task() comment

PATCH In review Jun Miao 3 participants 5 messages Aug 6, 2021 – Aug 11, 2021 Hung task detector

lore
Share & tools
lore

Jun Miao

author
#0 lore raw

PATCH 1/1 kernel/hung_task.c: Fix a typo in check_hung_task() comment

It's "mustn't", not "musn't". Let's fix that.

---
 kernel/hung_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/hung_task.c +1 -1
index 9888e2bc8c76..ea5ba912db06 100644
@@ -99,7 +99,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 	/*
 	 * When a freshly created task is scheduled once, changes its state to
 	 * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
-	 * musn't be checked.
+	 * mustn't be checked.
 	 */
 	if (unlikely(!switch_count))
 		return;
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Jun Miao

It's "mustn't", not "musn't". Let's fix that.

-- Daniel

Quoted 18 lines
---
 kernel/hung_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/hung_task.c +1 -1
index 9888e2bc8c76..ea5ba912db06 100644
@@ -99,7 +99,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 	/*
 	 * When a freshly created task is scheduled once, changes its state to
 	 * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
-	 * musn't be checked.
+	 * mustn't be checked.
 	 */
 	if (unlikely(!switch_count))
 		return;
#2 lore raw
In reply to Jun Miao
Quoted 13 lines · Jun Miao

It's "mustn't", not "musn't". Let's fix that.

---
 kernel/hung_task.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/hung_task.c +0 -0
index 9888e2bc8c76..ea5ba912db06 100644

kernel/hung_task.c static void check_hung_task(struct task_struct *t, unsigned long timeout) · line 102

Quoted 5 lines
kernel/hung_task.c +1 -1
@@ -99,7 +99,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
        /*
         * When a freshly created task is scheduled once, changes its state to
         * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
-        * musn't be checked.
+        * mustn't be checked.

I cannot even parse this comment.

Does "When a freshly created task is scheduled once, changes its state to TASK_UNINTERRUPTIBLE" mean "When a freshly created task is scheduled once and it changes its state to TASK_UNINTERRUPTIBLE"?

Does this "it must not be checked" read as "it shall not be checked" (as in "because if you check it, something goes wrong") or "it is not required to be checked" (as in "usually, you need to check it (otherwise something goes wrong), but here in this case, you do not need to check it, because it cannot go wrong in this case")?

Fixing spelling mistakes is okay, but it is even better to check the sentence you are correcting and try to comprehend it.

Lukas

author
#3 lore raw
Quoted 26 lines · Lukas Bulwahn

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 12 lines · Jun Miao

It's "mustn't", not "musn't". Let's fix that.

---
  kernel/hung_task.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/hung_task.c +0 -0
index 9888e2bc8c76..ea5ba912db06 100644

kernel/hung_task.c static void check_hung_task(struct task_struct *t, unsigned long timeout) · line 102

Quoted 5 lines
kernel/hung_task.c +1 -1
@@ -99,7 +99,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
         /*
          * When a freshly created task is scheduled once, changes its state to
          * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
-        * musn't be checked.
+        * mustn't be checked.

I cannot even parse this comment.

Does "When a freshly created task is scheduled once, changes its state to TASK_UNINTERRUPTIBLE" mean "When a freshly created task is scheduled once and it changes its state to TASK_UNINTERRUPTIBLE"?

Quoted 8 lines

Does this "it must not be checked" read as "it shall not be checked" (as in "because if you check it, something goes wrong") or "it is not required to be checked" (as in "usually, you need to check it (otherwise something goes wrong), but here in this case, you do not need to check it, because it cannot go wrong in this case")?

Fixing spelling mistakes is okay, but it is even better to check the sentence you are correcting and try to comprehend it.

Hi Lukas, thanks for your advice from my heart.

From the context of code:
---
 90         unsigned long switch_count = t->nvcsw + t->nivcsw;
 91
 ... ...
 99         /*
100          * When a freshly created task is scheduled once, changes its state to 101          * TASK_UNINTERRUPTIBLE without having ever been switched out once, it 102          * mustn't be checked.
103          */
104         if (unlikely(!switch_count))
105                 return;
---

It should read as "it shall not be checked" (as in "because if you check it, something goes wrong") . When create a task and set it as "TASK_UNINTERRUPTIBLE" we don`t need to check "swtich_count=0". If check will report a false positive.

From a history commit cf2592f59c0e, there is a detail explain:
    - the task is freshly created and scheduled
    - it puts its state to TASK_UNINTERRUPTIBLE and is not yet switched out
    - check_hung_task() scans this task and will report a false positive because t->nvcsw + t->nivcsw == t->last_switch_count == 0

    Add a check for such cases.

Thanks
Jun

Quoted 1 line

Lukas

author
#4 lore raw

Hi,

    What about this spelling mistakes ?

Thanks
Jun

Quoted 69 lines · Jun Miao
Quoted 27 lines · Lukas Bulwahn

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 12 lines · Jun Miao

It's "mustn't", not "musn't". Let's fix that.

---
  kernel/hung_task.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/hung_task.c +0 -0
index 9888e2bc8c76..ea5ba912db06 100644

kernel/hung_task.c static void check_hung_task(struct task_struct *t, · line 103

Quoted 6 lines
kernel/hung_task.c +1 -1
@@ -99,7 +99,7 @@ static void check_hung_task(struct task_struct *t, 
 unsigned long timeout)
          /*
           * When a freshly created task is scheduled once, changes its state to
           * TASK_UNINTERRUPTIBLE without having ever been switched out once, it
-        * musn't be checked.
+        * mustn't be checked.

I cannot even parse this comment.

Does "When a freshly created task is scheduled once, changes its state to TASK_UNINTERRUPTIBLE" mean "When a freshly created task is scheduled once and it changes its state to TASK_UNINTERRUPTIBLE"?

Quoted 8 lines

Does this "it must not be checked" read as "it shall not be checked" (as in "because if you check it, something goes wrong") or "it is not required to be checked" (as in "usually, you need to check it (otherwise something goes wrong), but here in this case, you do not need to check it, because it cannot go wrong in this case")?

Fixing spelling mistakes is okay, but it is even better to check the sentence you are correcting and try to comprehend it.

Hi Lukas, thanks for your advice from my heart.

From the context of code:
---
 90         unsigned long switch_count = t->nvcsw + t->nivcsw;
 91
 ... ...
 99         /*
100          * When a freshly created task is scheduled once, changes its state to 101          * TASK_UNINTERRUPTIBLE without having ever been switched out once, it 102          * mustn't be checked.
103          */
104         if (unlikely(!switch_count))
105                 return;
---

It should read as "it shall not be checked" (as in "because if you check it, something goes wrong") . When create a task and set it as "TASK_UNINTERRUPTIBLE" we don`t need to check "swtich_count=0". If check will report a false positive.

From a history commit cf2592f59c0e, there is a detail explain:
    - the task is freshly created and scheduled
    - it puts its state to TASK_UNINTERRUPTIBLE and is not yet switched out
    - check_hung_task() scans this task and will report a false positive because t->nvcsw + t->nivcsw == t->last_switch_count == 0

    Add a check for such cases.

Thanks
Jun

Quoted 1 line

Lukas