[openib-general] [PATCH 02/17] ehca: module infrastructure

Heiko J Schick schihei at de.ibm.com
Sat Mar 4 07:44:28 PST 2006


Hello,

Roland Dreier wrote:
>     Grant> IA64 .config options allows 4k, 8K, 16K, 64K.  Default page
>     Grant> size is 16k.  SLES9 versions for SGI/Altix use 64K as the
>     Grant> default.
> 
> Yes, but fortunately no ia64 machines have an IBM GX bus, so you don't
> have to worry about the ehca driver ;)

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.

I've run the followng kmalloc(...) test source code to verify if kmalloc
addresses 4k aligned or not.

#define k(SIZE, PTR)                           \
         PTR = kmalloc(SIZE, GFP_KERNEL);       \
         printk(KERN_ERR "%d:%p\n", SIZE, PTR); \
         kfree(PTR);

k(32,   ptr);
k(64,   ptr);
k(128,  ptr);
k(256,  ptr);
k(512,  ptr);
k(1024, ptr);
k(2048, ptr);
k(4096, ptr);

The result was the following:

[85793.619261] 32:c000000002397a40
[85793.619270] 64:c00000003e149780
[85793.619280] 128:c0000000024fff80
[85793.619288] 256:c00000003e1ea180
[85793.619295] 512:c00000003e2c7400
[85793.619303] 1024:c00000003e3f4800
[85793.619312] 2048:c00000003e37c800
[85793.619320] 4096:c00000003e2c4000    <<< 4K aligned!

This means that kmalloc addresses are only on a 4K boundary if the
size is equal to 4096.

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?

I know it is a trivial problem. :)

Many thanks in advance!

Regards,
	Heiko




More information about the general mailing list