From: xiujianfeng <xiujianfeng@huawei.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: <mingo@redhat.com>, <peterz@infradead.org>,
<juri.lelli@redhat.com>, <vincent.guittot@linaro.org>,
<dietmar.eggemann@arm.com>, <bsegall@google.com>,
<mgorman@suse.de>, <bristot@redhat.com>, <gustavoars@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-hardening@vger.kernel.org>
Subject: Re: [PATCH -next] sched: Use struct_size() helper in task_numa_group()
Date: Mon, 10 Jan 2022 09:20:33 +0800 [thread overview]
Message-ID: <263460ee-c97f-73cf-fcbc-e47eb0e2905f@huawei.com> (raw)
In-Reply-To: <20220107093617.56e218dc@gandalf.local.home>
在 2022/1/7 22:36, Steven Rostedt 写道:
> On Fri, 7 Jan 2022 10:52:12 +0800
> Xiu Jianfeng <xiujianfeng@huawei.com> wrote:
>
>> Make use of struct_size() helper instead of an open-coded calculation.
>> There is no functional change in this patch.
>>
>> Link: https://github.com/KSPP/linux/issues/160
>> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
>> ---
>> kernel/sched/fair.c | 7 ++-----
>> 1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 095b0aa378df..265e37be0c92 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -2437,11 +2437,8 @@ static void task_numa_group(struct task_struct *p, int cpupid, int flags,
>> int i;
>>
>> if (unlikely(!deref_curr_numa_group(p))) {
>> - unsigned int size = sizeof(struct numa_group) +
>> - NR_NUMA_HINT_FAULT_STATS *
>> - nr_node_ids * sizeof(unsigned long);
>> -
>> - grp = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
>> + grp = kzalloc(struct_size(grp, faults, NR_NUMA_HINT_FAULT_STATS * nr_node_ids),
>> + GFP_KERNEL | __GFP_NOWARN);
> I just replied yesterday. Keep the size variable. The above is too much for
> a kzalloc().
thanks, I may missed your reply mail, I'll modify and resend this patch.
>
> -- Steve
>
>
>
>
>> if (!grp)
>> return;
>>
> .
next prev parent reply other threads:[~2022-01-10 1:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-07 2:52 Xiu Jianfeng
2022-01-07 14:36 ` Steven Rostedt
2022-01-10 1:20 ` xiujianfeng [this message]
2022-01-10 16:06 ` Peter Zijlstra
2022-01-10 16:11 ` Steven Rostedt
-- strict thread matches above, loose matches on Subject: below --
2021-12-21 13:21 Xiu Jianfeng
2022-01-06 16:39 ` Steven Rostedt
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=263460ee-c97f-73cf-fcbc-e47eb0e2905f@huawei.com \
--to=xiujianfeng@huawei.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=gustavoars@kernel.org \
--cc=juri.lelli@redhat.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.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 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®