From: Miaohe Lin <linmiaohe@huawei.com>
To: David Hildenbrand <david@redhat.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/3] mm/vmstat: simplify the array size calculation
Date: Sat, 17 Jul 2021 09:54:00 +0800 [thread overview]
Message-ID: <c980d49b-3953-3eff-8e2a-d7d24e53bdfa@huawei.com> (raw)
In-Reply-To: <79fb76da-f811-7030-abd6-1dd970e7ab53@redhat.com>
On 2021/7/16 20:58, David Hildenbrand wrote:
> On 15.07.21 14:29, Miaohe Lin wrote:
>> We can replace the array_num * sizeof(array[0]) with sizeof(array) to
>> simplify the code.
>
> Could have mentioned taht your fixing indentation of one "return true;"
>
Yes, but I thought that's too trivial to mention... I would pay attention to it later.
> LGTM
>
> Reviewed-by: David Hildenbrand <david@redhat.com>
Many thanks for your review and reply!
>
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>> mm/vmstat.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/mm/vmstat.c b/mm/vmstat.c
>> index 57e8e7fda7aa..76aef9510f6d 100644
>> --- a/mm/vmstat.c
>> +++ b/mm/vmstat.c
>> @@ -1889,17 +1889,15 @@ static bool need_update(int cpu)
>> /*
>> * The fast way of checking if there are any vmstat diffs.
>> */
>> - if (memchr_inv(pzstats->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS *
>> - sizeof(pzstats->vm_stat_diff[0])))
>> + if (memchr_inv(pzstats->vm_stat_diff, 0, sizeof(pzstats->vm_stat_diff)))
>> return true;
>> if (last_pgdat == zone->zone_pgdat)
>> continue;
>> last_pgdat = zone->zone_pgdat;
>> n = per_cpu_ptr(zone->zone_pgdat->per_cpu_nodestats, cpu);
>> - if (memchr_inv(n->vm_node_stat_diff, 0, NR_VM_NODE_STAT_ITEMS *
>> - sizeof(n->vm_node_stat_diff[0])))
>> - return true;
>> + if (memchr_inv(n->vm_node_stat_diff, 0, sizeof(n->vm_node_stat_diff)))
>> + return true;
>> }
>> return false;
>> }
>>
>
>
next prev parent reply other threads:[~2021-07-17 1:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 12:29 [PATCH 0/3] Cleanup for vmstat Miaohe Lin
2021-07-15 12:29 ` [PATCH 1/3] mm/vmstat: correct some wrong comments Miaohe Lin
2021-07-15 12:29 ` [PATCH 2/3] mm/vmstat: simplify the array size calculation Miaohe Lin
2021-07-16 12:58 ` David Hildenbrand
2021-07-17 1:54 ` Miaohe Lin [this message]
2021-07-15 12:29 ` [PATCH 3/3] mm/vmstat: remove unneeded return value Miaohe Lin
2021-07-16 12:59 ` David Hildenbrand
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=c980d49b-3953-3eff-8e2a-d7d24e53bdfa@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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