All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Miao <jun.miao@windriver.com>
To: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	deller@gmx.de, wei.liu@kernel.org,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/hung_task.c: Fix a typo in check_hung_task() comment
Date: Sat, 7 Aug 2021 20:21:25 +0800	[thread overview]
Message-ID: <c40abc2d-2343-2eba-a5e4-4309a2577908@windriver.com> (raw)
In-Reply-To: <CAKXUXMxrE=OO3K6fafU38GDp3cvEtRYrqo-w2-hDO6OrvHe26Q@mail.gmail.com>


On 8/6/21 10:27 PM, Lukas Bulwahn wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On Fri, Aug 6, 2021 at 1:41 PM Jun Miao <jun.miao@windriver.com> wrote:
>> It's "mustn't", not "musn't". Let's fix that.
>>
>> Signed-off-by: Jun Miao <jun.miao@windriver.com>
>> ---
>>   kernel/hung_task.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/hung_task.c b/kernel/hung_task.c
>> index 9888e2bc8c76..ea5ba912db06 100644
>> --- a/kernel/hung_task.c
>> +++ b/kernel/hung_task.c
>> @@ -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.

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
> Lukas

  reply	other threads:[~2021-08-07 12:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 11:40 [PATCH] kernel/hung_task.c: Fix a typo in check_hung_task() comment Jun Miao
2021-08-06 13:04 ` Daniel Bristot de Oliveira
2021-08-06 14:27 ` Lukas Bulwahn
2021-08-07 12:21   ` Jun Miao [this message]
2021-08-11  8:32     ` Jun Miao

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=c40abc2d-2343-2eba-a5e4-4309a2577908@windriver.com \
    --to=jun.miao@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bristot@redhat.com \
    --cc=deller@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=peterz@infradead.org \
    --cc=wei.liu@kernel.org \
    /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.