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

Re: [Xen-devel] [PATCH] remove dead code in allocate_memory

Hi Stefano,

On 01/13/2018 12:29 AM, Stefano Stabellini wrote:
lowmem is unchanged until after this loop, there is no point in testing
for its value. Moreover, Coverity complains about dead code.

Remove the lowmem test in the first loop.

While I understand Coverity complains about dead code, in that particular case I don't think removing this test is the right thing to do.

It is very easy to toggle lowmen to false in the declaration as this was done before ab5b00a "xen/arm: domain_build: allocate lowmem for dom0 as much as possible". One example would be keep low memory free for other purpose.


CID: 1381832
Signed-off-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 155c952..fa58906 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -277,7 +277,7 @@ static void allocate_memory(struct domain *d, struct 
kernel_info *kinfo)
      while ( order >= min_low_order )
-        for ( bits = order ; bits <= (lowmem ? 32 : PADDR_BITS); bits++ )
+        for ( bits = order ; bits <= 32; bits++ )
              pg = alloc_domheap_pages(d, order, MEMF_bits(bits));
              if ( pg != NULL )

Xen-devel mailing list



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