Skip to content

Commit 64632fd

Browse files
MiaoheLintorvalds
authored andcommitted
mm/vmstat: simplify the array size calculation
We can replace the array_num * sizeof(array[0]) with sizeof(array) to simplify the code. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Miaohe Lin <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ea15ba1 commit 64632fd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

mm/vmstat.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,17 +1891,15 @@ static bool need_update(int cpu)
18911891
/*
18921892
* The fast way of checking if there are any vmstat diffs.
18931893
*/
1894-
if (memchr_inv(pzstats->vm_stat_diff, 0, NR_VM_ZONE_STAT_ITEMS *
1895-
sizeof(pzstats->vm_stat_diff[0])))
1894+
if (memchr_inv(pzstats->vm_stat_diff, 0, sizeof(pzstats->vm_stat_diff)))
18961895
return true;
18971896

18981897
if (last_pgdat == zone->zone_pgdat)
18991898
continue;
19001899
last_pgdat = zone->zone_pgdat;
19011900
n = per_cpu_ptr(zone->zone_pgdat->per_cpu_nodestats, cpu);
1902-
if (memchr_inv(n->vm_node_stat_diff, 0, NR_VM_NODE_STAT_ITEMS *
1903-
sizeof(n->vm_node_stat_diff[0])))
1904-
return true;
1901+
if (memchr_inv(n->vm_node_stat_diff, 0, sizeof(n->vm_node_stat_diff)))
1902+
return true;
19051903
}
19061904
return false;
19071905
}

0 commit comments

Comments
 (0)