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

Re: [PATCH 17/22] x86/setup: vmap heap nodes when they are outside the direct map


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 11 Jan 2023 15:39:18 +0100
  • 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=wLFn4NbS1Lo3PpETX2gDmRJejP1llNLWgrYgaeEIQ5M=; b=WUTbBFt8P5H/Uk2jllIuUm7SKercGaVFmCX42k9Qaf7ZjPqAog13T8ffd8BGT7F9O/g/4DT7aGIP5xODxNb0umX4Vkinl2p+TddTmiQJVWSztb++RVitPmzqOmiwXDAYdp199PUrLOYYixLD3reuzLAnce5/Y6pnQUMvKlHwLdy/jEuuN2hr3vHbvKwIIxEtVFawPxvZSTLanVbQIfwicZf9I2WN1lmVYco7KO460rOLXh7sqPwnCGKHFz39HsIkLIj7jksjxEc3CQVybDV3d6ULruAmLW7R1AJk9wI4+kJTNO+jaiPGwazib5MPTPPTbNuruHeL9BkBbhgTDlLAvA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bCsAl/kMOXrBQ+C84FPAsm2zEivtdtQMLY9fJE+RdP020q3F3RNI1mpJMumi1UhYOarGF+BskxCJ0WwI3d8ViT0R2/hr6x6zI7+SIr8/ytWWRquozs8Y8f90PJmuTp2QBEqVYSrn/OSuO9kKCsBDTK2cgs1yO+RwqzC7//9I3cHUOcxLQyl8d0vdAgOhe8Qm6lFdaZJ16E2ixK6YfeccAwszvzzm5kQcPMg2sjyiKcxfhR3BSKEykUYOz1EpICxGYb7xyK35/Kn7gYQOxQ7FFDKk0T+kC/+ezbBooXyAS6BJTPCtLx+F73TKcES+PDwev3udnU/JM9toIBvOQ6lURw==
  • 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: Wed, 11 Jan 2023 14:45:18 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.12.2022 12:48, Julien Grall wrote:
> @@ -597,22 +598,43 @@ static unsigned long init_node_heap(int node, unsigned 
> long mfn,
>          needed = 0;
>      }
>      else if ( *use_tail && nr >= needed &&
> -              arch_mfns_in_directmap(mfn + nr - needed, needed) &&
>                (!xenheap_bits ||
>                 !((mfn + nr - 1) >> (xenheap_bits - PAGE_SHIFT))) )
>      {
> -        _heap[node] = mfn_to_virt(mfn + nr - needed);
> -        avail[node] = mfn_to_virt(mfn + nr - 1) +
> -                      PAGE_SIZE - sizeof(**avail) * NR_ZONES;
> -    }
> -    else if ( nr >= needed &&

By replacing these two well-formed lines with ...

> -              arch_mfns_in_directmap(mfn, needed) &&
> +        if ( arch_mfns_in_directmap(mfn + nr - needed, needed) )
> +        {
> +            _heap[node] = mfn_to_virt(mfn + nr - needed);
> +            avail[node] = mfn_to_virt(mfn + nr - 1) +
> +                          PAGE_SIZE - sizeof(**avail) * NR_ZONES;
> +        }
> +        else
> +        {
> +            mfn_t needed_start = _mfn(mfn + nr - needed);
> +
> +            _heap[node] = vmap_contig_pages(needed_start, needed);
> +            BUG_ON(!_heap[node]);
> +            avail[node] = (void *)(_heap[node]) + (needed << PAGE_SHIFT) -
> +                          sizeof(**avail) * NR_ZONES;
> +        }
> +    } else if ( nr >= needed &&

... this, you're not only violating style here, but you also ...

>                (!xenheap_bits ||
>                 !((mfn + needed - 1) >> (xenheap_bits - PAGE_SHIFT))) )

... break indentation for these two lines.

Jan



 


Rackspace

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