Re: Buddy system - bitmap size calculation

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

 



On Mon, 19 Sep 2005, Sudharsan  Vijayaraghavan wrote:

>         0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> 
> 0 order  0   1   2   3   4    5     6     7
> 1 order     0      1       2          3
> 2 order            0               1
> 3 order                    0

> bitmap_size = (size-1) >> (i+4);
> i takes value for 0 to 9 since MAX_ORDER is 10 .
> MAX_ORDER is 10 because the order can span from 0 to 9

Remember that bitmap_size is in bits, not bytes.  So for
order 0, you get ((size-1) / 16) bytes; this corresponds
to one bit for every two pages.

-- 
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux