| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 1/2] lib/ukallocbbuddy: Fix definition and assertions of memr.nr_pages
 On Sat, Mar 17, 2018 at 3:48 AM, Costin Lupu <costin.lup@xxxxxxxxx> wrote: On 03/17/2018 01:19 AM, Bruno Alvisio wrote: I am still trying to come up with an example in which the number of pages would end up being different by using the current code vs. your approach. E.g.: (that doesn't work) Start with min = 0; PAGE_SIZE = 512; size(*m) = 20: 1. Code: range = 8 * PAGE_SIZE * (PAGE_SIZE - sizeof(*memr) + 1) = 8 * (512 * 493) = 2019328 memr_size = 2*512 = 1024            // 2*PAGE_SIZE min = 1024 nr_pages = (2019328 - 1024) >> 9 = 3942. 2. Using inequality:  nr_pages = BITS_PER_BYTE * (range - sizeof(*memr)) / (BITS_PER_BYTE * __PAGE_SIZE + 1) nr_pages = 8 * (2019328 -20) / (8 * 512 + 1) = 16154464/4097 = 3942.99 -> 3942 => memr_size = round_pgup( 20 + 3942/8 ) =  round_pgup(20 + 492.75) =  round_pgup(513) = 1024     // 2*PAGE_SIZE It would be great if you can provide me a corner case that shows the difference. 
 Got it. Didn't see that in this function was also recieving the address instead of page num. 
 Thanks for the clarifications, Bruno  _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel 
 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |