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

Re: [PATCH v9 6/8] xen/arm: unpopulate memory when domain is static


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 25 Jul 2022 17:35:30 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=IQRQ4PQdqjivhqvwrVdrxAnblF6BKWoJt05WMl82ao0=; b=Ki+Q6ShyKMkjinObUHUF57xhCZ7YCk++Q/3jjQYULlh+78AXCjd0HiYtr0gA/7rpH2aXjSH8Av1Y8S90gZPIExflK2AiGbBI56fvJKWIhbW85mLkpRAylOszw0lUY9X3JtOh9LixZaoJqhcXkBzZCB5OChE1uZ3648RZxwbMUq2H8cvwhjz3Xfu28K/+hJLnyj6dUHO0Q9zORVbd7UMUVydR7ebUg5a+JkHtGCv5LIjMokuHdO8dcT+fIiXyejwEfFODRi+Z8LdPaHuzXzWgACq2Ptc56tU5IzzQTzOrOg1um7JmLioFu9510XV/8NxrtkApazwcJiO4ggdKkA5bTw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JAvqz3SSisAzinBkF3QTTF0u62qdfoDL2yXvg8g7Vg6FnUdR2aaD3diRTLJGz69i3i3FziddjUxqMXSgqLUKD82xDvJKUvAiYeXiCSk7aljWQNi2RT/SPjRy47lyfhQZ/Ul57EUOmsd+IPHT/dnLZOwJ/d03l9ZlgWhqq6dbJPVLRpUmlRa/S4m+u7ztsTMlbBP0ZWx2WdV3oQH7z5bUDGEd1gQDQoH2s2PxUqE6Q20ZAnKzSC8fpimBq9H+3Ap/XfvExam1GtAQ7Ah7QZTh7IqwzR9X3VYUXEXbuVdRJGqywGh9X29Ps+iNSbn22fX0OuKY+eKe8QPByx2vFtgsvw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: wei.chen@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 25 Jul 2022 15:35:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.07.2022 07:46, Penny Zheng wrote:
> Today when a domain unpopulates the memory on runtime, they will always
> hand the memory back to the heap allocator. And it will be a problem if domain
> is static.
> 
> Pages as guest RAM for static domain shall be reserved to only this domain
> and not be used for any other purposes, so they shall never go back to heap
> allocator.
> 
> This commit puts reserved pages on the new list resv_page_list only after
> having taken them off the "normal" list, when the last ref dropped.

I guess this wording somehow relates to ...

> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -2674,10 +2674,14 @@ void free_domstatic_page(struct page_info *page)
>  
>      drop_dom_ref = !domain_adjust_tot_pages(d, -1);
>  
> -    spin_unlock_recursive(&d->page_alloc_lock);
> -
>      free_staticmem_pages(page, 1, scrub_debug);
>  
> +    /* Add page on the resv_page_list *after* it has been freed. */
> +    if ( !drop_dom_ref )
> +        page_list_add_tail(page, &d->resv_page_list);

... the conditional used here. I cannot, however, figure why there is
this conditional (and said part of the description also doesn't help
me figure it out).

As an aside: A title prefix of xen/arm: suggests you're mostly
touching Arm code. But you're touching exclusively common code here.
I for one would almost have skipped this patch (more than once) when
deciding which ones (may) want me looking at them.

Jan



 


Rackspace

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