From: "晏艳(采苓)" <yanyan.yan@antgroup.com>
To: linux-kernel@vger.kernel.org
Cc: 谈鉴锋 <henry.tjf@antgroup.com>,
"Tiwei Bie" <tiwei.btw@antgroup.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Juri Lelli" <juri.lelli@redhat.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
"Daniel Bristot de Oliveira" <bristot@redhat.com>,
"Valentin Schneider" <vschneid@redhat.com>
Subject: Re: [PATCH v1 1/3] sched/debug: use int type and fix wrong print for rq->nr_uninterruptible
Date: Tue, 25 Apr 2023 20:14:23 +0800 [thread overview]
Message-ID: <3ac59e0f-507f-4603-033b-e493c290cf9f@antgroup.com> (raw)
In-Reply-To: <269db8cf-4ff0-70e4-80f3-36970d0a2169@antgroup.com>
在 2023/4/19 15:46, 晏艳 写道:
>
>
> 在 2023/4/12 11:07, 晏艳(采苓) 写道:
>> commit e6fe3f422be1 ("sched: Make multiple runqueue task counters
>> 32-bit") changed rq->nr_uninterruptible from 'unsigned long'
>> to 'unsigned int', but left the wrong print to
>> /sys/kernel/debug/sched/debug and to the console.
>>
>> For example:
>> Current type is 'unsigned int' and value is fffffff7, and the print
>> will run the sentences,
>> "do { \
>> if (sizeof(rq->x) == 4) \
>> SEQ_printf(m, " .%-30s: %ld\n", #x, (long)(rq->x)); \
>> else \
>> SEQ_printf(m, " .%-30s: %Ld\n", #x, (long long)(rq->x));\
>> } while (0)"
>>
>> The result will be 4294967287 on 64-bit machines to print (long)(rq->x)
>> while old type 'unsigned long' will print -9.
>>
>> And the other places that use its value will cast to int to return
>> expected output, so we convert its type from 'unsigned int' to int.
>>
>> Signed-off-by: Yan Yan<yanyan.yan@antgroup.com>
>> ---
>> kernel/sched/loadavg.c | 2 +-
>> kernel/sched/sched.h | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
> Ping, any comment?
>
> thanks,
> -Yan Yan
Ping, any comment?
thanks,
-Yan Yan
>> diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
>> index 52c8f8226b0d..b9867495fe8b 100644
>> --- a/kernel/sched/loadavg.c
>> +++ b/kernel/sched/loadavg.c
>> @@ -80,7 +80,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
>> long nr_active, delta = 0;
>>
>> nr_active = this_rq->nr_running - adjust;
>> - nr_active += (int)this_rq->nr_uninterruptible;
>> + nr_active += this_rq->nr_uninterruptible;
>>
>> if (nr_active != this_rq->calc_load_active) {
>> delta = nr_active - this_rq->calc_load_active;
>> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
>> index 060616944d7a..23c643948331 100644
>> --- a/kernel/sched/sched.h
>> +++ b/kernel/sched/sched.h
>> @@ -1006,7 +1006,7 @@ struct rq {
>> * one CPU and if it got migrated afterwards it may decrease
>> * it on another CPU. Always updated under the runqueue lock:
>> */
>> - unsigned int nr_uninterruptible;
>> + int nr_uninterruptible;
>>
>> struct task_struct __rcu *curr;
>> struct task_struct *idle;
next prev parent reply other threads:[~2023-04-25 12:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 3:07 [PATCH v1 0/3] correct printing for rq->nr_uninterruptible and some updates 晏艳(采苓)
2023-04-12 3:07 ` [PATCH v1 1/3] sched/debug: use int type and fix wrong print for rq->nr_uninterruptible 晏艳(采苓)
[not found] ` <269db8cf-4ff0-70e4-80f3-36970d0a2169@antgroup.com>
2023-04-25 12:14 ` 晏艳(采苓) [this message]
2023-04-25 12:48 ` Peter Zijlstra
2023-04-12 3:07 ` [PATCH v1 2/3] sched/debug: update description of print 晏艳(采苓)
2023-04-12 3:07 ` [PATCH v1 3/3] sched: remove duplicate included headers psi.h 晏艳(采苓)
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=3ac59e0f-507f-4603-033b-e493c290cf9f@antgroup.com \
--to=yanyan.yan@antgroup.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=henry.tjf@antgroup.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tiwei.btw@antgroup.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®