[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V4 4/8] xen/common: Introduce _xrealloc function
On 23.09.19 16:31, Jan Beulich wrote: Hi, Jan + + if ( ptr == NULL || ptr == ZERO_BLOCK_PTR ) + return _xmalloc(size, align); + + ASSERT((align & (align - 1)) == 0); + if ( align < MEM_ALIGN ) + align = MEM_ALIGN; + + tmp_size = size + align - MEM_ALIGN; + + if ( tmp_size < PAGE_SIZE ) + tmp_size = (tmp_size < MIN_BLOCK_SIZE) ? MIN_BLOCK_SIZE : + ROUNDUP_SIZE(tmp_size); + + if ( !((unsigned long)ptr & (PAGE_SIZE - 1)) ) + { + curr_size = (unsigned long)PFN_ORDER(virt_to_page(ptr)) << PAGE_SHIFT; + + if ( tmp_size <= curr_size && ((unsigned long)ptr & (align - 1)) == 0 )You mean "size" here I think, not "tmp_size". See how xmalloc_whole_pages() gets called from _xmalloc() with an "adjusted back" value. Yes, thank you for pointing this. And as said, please clean up the code you move or add anew: Use casts only where really needed, transform types to appropriate "modern" ones, etc. ok, will double check. -- Regards, Oleksandr Tyshchenko _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |