Reputation: 1629
Given a system supports a certain page-size of X-KB (Power of 2), and I have a certain number of bytes Y-Bytes(May or May not be a multiple of X). Is there a macro that will give me a "ceil" of the number of pages that would amount to Y-Bytes ?
Thanks, vj
Upvotes: 0
Views: 161
Reputation: 14046
Not sure if there is such a macro. But you can easily write your own using the asm/page.h PAGE_SIZE and PAGE_SHIFT definitions.
NUM_PAGES(y) ((y + PAGE_SIZE - 1) >> PAGE_SHIFT)
or
NUM_PAGES(y) ((y + PAGE_SIZE - 1) / PAGE_SIZE)
Upvotes: 1