[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/3] xen/heap: pass order to free_heap_pages() in heap init
- To: Julien Grall <julien@xxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Mon, 18 Jul 2022 11:43: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=8dLd18yrvmKkY6RdSDTFDHEopdb2NaPYrmYREfKHUus=; b=hIX9SvDy+rREyE1J9KlzI1guSPK5BGBZCXylBp6P6ae4m4Ij32yf8YPthulCmV3BpwxAFC0dECFkF9cw09dbqVgtFNLltb0yB/BHr4UvN3pwfrGUB4E53tqviteOeXuQta/0RLu1Te1Ll2tRYNy+riHLJtQwcE35VnQaBzEn24m5WEG7TE6Eeh2L778oug4/ybl4TctvxByiYFlKxG+wV/AXBqPcw66I/moQa7UijQkGSXr3jZK0ic7KU9EbUfK3y3NtdImqhP0Cx3NoMORXG91AZYOvY+5n5xx/m5ksh7Djl2HUpEd8CHxmlQ4F7aFIywCzN1CSMygO4rK0DmOzhw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ToWbAoIGmWiB2JWApOjwq1nhSt76bY9RiF0g9NFpNhfIDGzQ5a4+vLw+c282uSno9JsIttFZx2Xd7j0Bq/7VZOsoH3CQwbYAkZ0wO2IL5WeFXUgkY7HAIEfo74JPdDpc1T71VqStpvikYEnfMarVLNw9Yi+Pxar/gUmnIDVDiCqetcyXbqbvjtXpBcspsAka4zXdn9c8cHJQvbfg+MPwDjlTq39o+WRYurAMsBHXqGCyQD1+56+mf5SUeasZ3R0P03Pt57Yp+bvsYEnQBWyN0pWVHLN7r8Ux8RrUnyIuQnp4ZMmWizVew91mG9naaCzm+8h+xYAHbO94yCdtL8ZpQQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Hongyan Xia <hongyxia@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 18 Jul 2022 09:43:42 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 15.07.2022 19:03, Julien Grall wrote:
> @@ -1806,8 +1806,22 @@ static void _init_heap_pages(const struct page_info
> *pg,
>
> while ( s < e )
> {
> - free_heap_pages(mfn_to_page(_mfn(s)), 0, need_scrub);
> - s += 1UL;
> + /*
> + * For s == 0, we simply use the largest increment by checking the
> + * MSB of the region size. For s != 0, we also need to ensure that
> the
> + * chunk is properly sized to end at power-of-two alignment. We do
> this
> + * by checking the LSB of the start address and use its index as
> + * the increment. Both cases need to be guarded by MAX_ORDER.
s/guarded/bounded/ ?
> + * Note that the value of ffsl() and flsl() starts from 1 so we need
> + * to decrement it by 1.
> + */
> + int inc_order = min(MAX_ORDER, flsl(e - s) - 1);
unsigned int, since ...
> + if ( s )
> + inc_order = min(inc_order, ffsl(s) - 1);
> + free_heap_pages(mfn_to_page(_mfn(s)), inc_order, need_scrub);
... that's what the function parameter says, and the value also can go
negative? Preferably with these adjustments
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
|