Cannot allocate much space using pmemobj alloc class

45 views
Skip to first unread message

Denny Zhao

unread,
Aug 29, 2018, 4:07:40 PM8/29/18
to pmem
I have a 32GB dax device. When using alloc classes, I met several issues/questions:

1. With following alloc class:
{
unit_size:  1048576,
units_per_block:  1024, 
alignment:  4096,
header_type: POBJ_HEADER_COMPACT
}

When allocating objects of 1MB size, it returns ENOMEM afer several allocations. But pmempool info shows that only 5 GB is used. 

2. With the following alloc class:
{
unit_size:  131072,
units_per_block:  1, 
alignment:  4096,
header_type: POBJ_HEADER_COMPACT
}
When objects of 128KB (obj size equals unit_size), no object can be allocated.

3. Type num seems not working either of above alloc class.

4. If I use pmemobj_xallloc (with alloc class specified) and pmemobj_alloc (with no alloc class specified) on the same pmem pool, will that cause any problems?

Thanks,
Denny


Piotr Balcer

unread,
Sep 3, 2018, 9:12:12 AM9/3/18
to pmem
Hi,

1. With following alloc class:
{
unit_size:  1048576,
units_per_block:  1024, 
alignment:  4096,
header_type: POBJ_HEADER_COMPACT
}

When allocating objects of 1MB size, it returns ENOMEM afer several allocations. But pmempool info shows that only 5 GB is used. 

If this is the only thing in the pool, you should be able to allocate roughly the entire pool using this allocation class.
Keep in mindthat /w POBJ_HEADER_COMPACT you have to account for the 16 byte header, thus the optimal allocation
from this class is in fact `(N * (1 << 20)) - 16`, where N is number between 1 and 64.

pmempool info currently does not display statistics for custom allocation classes. This will be addressed in the upcoming release.


2. With the following alloc class:
{
unit_size:  131072,
units_per_block:  1, 
alignment:  4096,
header_type: POBJ_HEADER_COMPACT
}
When objects of 128KB (obj size equals unit_size), no object can be allocated.

This works as expected. You requested an allocation class with unit size of 128kb
and a single unit per block, and then requested 2 units (because of the POBJ_HEADER_COMPACT,
allocating 128kb from this class requires two units), which fails because this request
cannot be satisfied.
For classes this large, never use this small units per block, as it will be aligned down to a chunk size (256kb).
Please see libpmemobj man page for more information.

 
3. Type num seems not working either of above alloc class.
 

The POBJ_HEADER_COMPACT does support type numbers. This is verified in many tests in our repository.

 
4. If I use pmemobj_xallloc (with alloc class specified) and pmemobj_alloc (with no alloc class specified) on the same pmem pool, will that cause any problems?

It should be perfectly fine - in fact, that's the intended usage model.
 

Piotr

Denny Zhao

unread,
Sep 9, 2018, 5:09:30 AM9/9/18
to pmem
Thank you Piotr! Now we use header none, and all issues fixed, with the only pitfall that an object cannot be across multipe units.

在 2018年9月3日星期一 UTC+8下午9:12:12,Piotr Balcer写道:
Reply all
Reply to author
Forward
0 new messages