Re: [PATCH 3/9] mm/vmstat: Convert NUMA statistics to basic NUMA counters
From: Mel Gorman
Date: Fri Apr 23 2021 - 04:32:13 EST
On Thu, Apr 22, 2021 at 05:18:38PM +0200, Vlastimil Babka wrote:
> > +
> > +#ifdef CONFIG_NUMA
> > +static void fold_vm_zone_numa_events(struct zone *zone)
> > {
> > - int i;
> > - int changes = 0;
> > + int zone_numa_events[NR_VM_NUMA_EVENT_ITEMS] = { 0, };
>
> Should this be long? pzstats are, the global counters too, so seems weird to use
> int as intermediate sum counter.
>
While overflow can happen eventually, unsigned long defers the problem
so yes, I'll make it unsigned long.
> > #ifdef CONFIG_NUMA
> > - for (i = 0; i < NR_VM_NUMA_STAT_ITEMS; i++)
> > - if (pzstats->vm_numa_stat_diff[i]) {
> > + for (i = 0; i < NR_VM_NUMA_EVENT_ITEMS; i++) {
> > + if (pzstats->vm_numa_event[i]) {
> > int v;
>
> Also long?
>
Same.
> > /*
> > @@ -939,43 +914,36 @@ void cpu_vm_stats_fold(int cpu)
> > */
> > void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *pzstats)
> > {
> > - int i;
> > + int i, v;
>
> And the 'v' here. Maybe keep using local to each loop below and make it long for
> the NUMA one?
>
I just made it unsigned long. There is no storage advantage to changing
type in a local scoped variable.
Thanks
--
Mel Gorman
SUSE Labs