[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] xen/mm: add a NUMA node parameter to scrub_free_pages()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 9 Jan 2026 15:46:50 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qHm14Zsieid21GtiDfTQPG6U+ZFeb1sFsD9NGsh1ClM=; b=X2Zx+mznZMptYZChMmv770Wv0LzHcz1Ko5IuOPM7of0cRau6CuZqg1ZYNWgLOD+X1rThlKz29D4ORf7K536asHqejvz2oNPvcPvIWZcCvexf3leACunaV9AHpnvDOoub9lsSpw0mITFq08gTOZdTTxhkecLdN5hWKgm2oIC4vDf5zASCeeFcujCGsxZhUsFmQIAGRIMQAitNGH7arSj2tsvc4TVw6tKZj5gh49x9chp/6YZOTVLGjavSWia3sk7ar88j2rxxsnFYV6ECGuFA+OxYimfbfydx8B6jPpuD+anV6zaFeCWBPaMlV+NRAQBiBLpnU3/ZWHuNgnlWOjgUUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lsx/s1oSOEfAOCPodMUoS2dwN5pIMY6ji8+ID5L7rNWuId6hVZ2pYsn4e05QySncoODFVyqiQOjj5fPAt+mo4A8Yq7iEy6rIPRpnz2yCF3nFwFGigzmqITaNyZijKXR06ktD+h2W1eCZuWx+jYXhug4iaD9NBqpqwAwr2McGIu1bJc+yRKFOLI8qzyWSiOh2bD32mqzdvHQffrCka0oOHxo3t2Awqa3cQeFLlS+y/a6kcCXKUr5f+mR5pzU6RT6Z7G6EJpoIGwHP29pCfpn1lRKXBgm7Q8FcmdIf51b9Du/Bi7Eadnw4vVS4gCCgL/ae9+Ie4LFHFb8uOLtFnaxfxA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 09 Jan 2026 14:47:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Jan 09, 2026 at 11:22:39AM +0100, Jan Beulich wrote:
> On 08.01.2026 18:55, Roger Pau Monne wrote:
> > Such parameter allow requesting to scrub memory only from the specified
> > node.  If there's no memory to scrub from the requested node the function
> > returns false.  If the node is already being scrubbed from a different CPU
> > the function returns true so the caller can differentiate whether there's
> > still pending work to do.
> 
> I'm really trying to understand both patches together, and peeking ahead I
> don't understand the above, which looks to describe ...
> 
> > --- a/xen/common/page_alloc.c
> > +++ b/xen/common/page_alloc.c
> > @@ -1339,16 +1339,27 @@ static void cf_check scrub_continue(void *data)
> >      }
> >  }
> >  
> > -bool scrub_free_pages(void)
> > +bool scrub_free_pages(nodeid_t node)
> >  {
> >      struct page_info *pg;
> >      unsigned int zone;
> >      unsigned int cpu = smp_processor_id();
> >      bool preempt = false;
> > -    nodeid_t node;
> >      unsigned int cnt = 0;
> >  
> > -    node = node_to_scrub(true);
> > +    if ( node != NUMA_NO_NODE )
> > +    {
> > +        if ( !node_need_scrub[node] )
> > +            /* Nothing to scrub. */
> > +            return false;
> > +
> > +        if ( node_test_and_set(node, node_scrubbing) )
> > +            /* Another CPU is scrubbing it. */
> > +            return true;
> 
> ... these two return-s. My problem being that patch 2 doesn't use the
> return value (while existing callers don't take this path). Is this then
> "just in case" for now (and making the meaning of the return values
> somewhat inconsistent for the function as a whole)?

I've added those so that the function return values are consistent,
even if not consumed right now, it would make no sense for the return
values to have different meaning when the node parameter is !=
NUMA_NO_NODE.  Or at least that was my impression.

In fact an earlier version of patch 2 did consume those values.  I've
moved to a different approach, but I think it's good to keep the
return values consistent regardless of the input parameters.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.