On Fri, 2008-10-24 at 13:07 +0200, Thomas Klein wrote:
Does this support a case where a userspace app is reading network
packets into a 16GB page backed area? I think you need to elaborate on
what kind of memory you need to have registered in these memory regions.
It's hard to review what you've done here otherwise.
This probably needs a comment. It's not obvious what it is doing.
Whoa. That's dense. Can you actually read that in less than 5 minutes?
Seriously.
I'm not sure what else you use EHEA_HUGEPAGE_SIZE for or if this gets
duplicated, but this would look nicer if you just had a:
#define EHEA_HUGEPAGE_PFN_MASK ((EHEA_HUGEPAGE_SIZE - 1) >> PAGE_SHIFT)
if (pfn & EHEA_HUGEPAGE_PFN_MASK)
return 0;
Or, with no new macro:
if ((pfn << PAGE_SHIFT) & (EHEA_HUGEPAGE_SIZE - 1) != 0)
return 0;
page_order = compound_order(pfn_to_page(pfn));
if (page_order + PAGE_SHIFT != EHEA_HUGEPAGESHIFT)
return 0;
return 1;
}
Please break that up into something that is truly readable. gcc will
generate the exact same code.
I'm a bit worried that you're basically duplicating hugetlb.h here. Why
not just use the existing 16GB page macros? While you're at it please
expand these to give some more useful macros so you don't have to do
arithmetic on them in the code as much.
#define EHEA_SECT_NR_PAGES (EHEA_SECTSIZE / PAGE_SIZE)
for instance.
-- Dave
--