[openib-general] [PATCH 02/17] ehca: module infrastructure
Roland Dreier
roland.list at gmail.com
Sat Mar 4 16:12:55 PST 2006
> as far as I know PPC64 supports 4K and 64K page sizes. We have to give
> several control blocks to PHYP. This control blocks have different sizes
> and have to be on a 4K boundary.
OK.
> This means that kmalloc addresses are only on a 4K boundary if the
> size is equal to 4096.
Yes, if you think about the way the slab allocator works, there's no
way for smaller objects to have a guaranteed alignment.
> I have the following options to allocate memory for the control blocks:
>
> (1):
> kzalloc(PAGE_SIZE, GFP_KERNEL)
> kfree(addr);
>
> (2):
> __get_zeroed_page(GFP_KERNEL)
> fref_page(addr);
>
> (3):
> kzalloc(4096, GFP_KERNEL)
> kfree(addr);
>
> Personaly I would prefer (1) or (2). Sure, this means that we allocate
> 64K of memory if somebody uses large pages, but they will be 4K aligned,
> too. What is also the best option to implement?
It seems grotesquely wasteful to me to allocate 64K just to get a 4K
aligned block. How about doing something like
#define PHYP_CB_ALIGNMENT 4096
kzalloc(PHYP_CB_ALIGNMENT, GFP_KERNEL);
That way you make it clear what you're doing and why.
- R.
More information about the general
mailing list