[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBpX2L8/Nd39CiH9@tpad>
Date: Tue, 21 Mar 2023 22:20:24 -0300
From: Marcelo Tosatti <mtosatti@...hat.com>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: Christoph Lameter <cl@...ux.com>,
Aaron Tomlin <atomlin@...mlin.com>,
Frederic Weisbecker <frederic@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Russell King <linux@...linux.org.uk>,
Huacai Chen <chenhuacai@...nel.org>,
Heiko Carstens <hca@...ux.ibm.com>, x86@...nel.org,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...e.com>
Subject: Re: [PATCH v7 13/13] vmstat: add pcp remote node draining via
cpu_vm_stats_fold
On Mon, Mar 20, 2023 at 01:43:09PM -0700, Tim Chen wrote:
> On Mon, 2023-03-20 at 15:03 -0300, Marcelo Tosatti wrote:
> >
> > +
> > + if (do_pagesets) {
> > + cond_resched();
> > + /*
> > + * Deal with draining the remote pageset of a
> > + * processor
> > + *
> > + * Check if there are pages remaining in this pageset
> > + * if not then there is nothing to expire.
> > + */
> > + if (!pcp->expire || !pcp->count)
> > + continue;refresh_cpu_vm_stats
> > +
> > + /*
> > + * We never drain zones local to this processor.
> > + */
> > + if (zone_to_nid(zone) == cpu_to_node(cpu)) {
> > + pcp->expire = 0;
> > + continue;
> > + }
> > +
> > + WARN_ON(pcp->expire < 0);
> > + /*
> > + * pcp->expire is only accessed from vmstat_shepherd context,
> > + * therefore no locking is required.
> > + */
> > + if (--pcp->expire)
> > + continue;
> > +
> > + if (pcp->count)
> > + drain_zone_pages(zone, pcp);
> > + }
>
> This logic is the same to that for the do_pagesets portion of code in refresh_cpu_vm_stats().
> Is it possible to consolidate to avoid replicating the logic across two functions?
>
> Tim
Tim,
One of the versions is for remote access, the other version is for local
access (thats why merging the two is not so simple).
I suppose the next logical step would be ensure that the current
!CONFIG_HAVE_CMPXCHG_LOCAL also uses the cmpxchg remotely (then
refresh_cpu_vm_stats can be removed).
Powered by blists - more mailing lists