Deprecate k_mem_pool API, remove sys_mem_pool allocator #28611
The k_heap/sys_heap code has been default for a release, so it's time to deprecate the old allocator.
This eliminates the older CONFIG_MEM_POOL_HEAP_BACKEND kconfig, effectively making it true always and removing the ability for applications to request the older pool engine. It then deprecates the older APIs, leaving them in place for internal users as a "Z" API.
There are still a few users of the older API internally that will need cleanup (edit: not anymore, it's 100% gone in the current version). I'll submit those separately I think, I'm not sure if those are in scope for 2.4 or not:
And there are two places where the underlying sys_heap allocator still gets used:
The text was updated successfully, but these errors were encountered:
I'm not clear on how #24358 is a bug, let alone having a release-blocking priority, except as a means of getting this late change into 2.4.0. And I've been told before that stage of release cycle is not a valid reason for rejecting a PR.
But from policy discussion heard at the last TSC regarding criteria for accepting late addition of new boards I need to ask: If a PR like this came three days before release from anybody other than a platinum member company, would people be seriously considering merging it into the release when it passes?
The older sys_mem_pool is going away and being replaced by a new allocator. Signed-off-by: Andy Ross <firstname.lastname@example.org>
This code used a sys_mem_pool directly. Use a new-style heap instead to do the same thing. (Note that the usage is a little specious -- it allocates from the heap but doesn't appear to fill or check any data therein, just that the heap memory can be copied from the two memory domains. It's unclear exactly what this is trying to demonstrate and we might want to improve the sample to do something less trivial.) Signed-off-by: Andy Ross <email@example.com>
These two test cases were making whitebox assumptions of both the block header size and memory layout of an old-style k_mem_pool that aren't honored by the k_heap allocator. They aren't testing anything that isn't covered elsewhere. Signed-off-by: Andy Ross <firstname.lastname@example.org>
This test was written to use a TINY system heap (64 bytes) from which it has to allocate on behalf of a userspace process. The change in convention from mem_pool (where the byte count now includes metadata overhead) means it runs out of space. Bump to 192 bytes. Still tiny. Signed-off-by: Andy Ross <email@example.com>
On userspace platforms, this test needs a little bit of kernel heap. The old mem_pool number was specified without metadata overhead (i.e. it reflected 128 bytes of actual data available and the metadata was stored silently somewhere else), where the new heap specifies the size of the contiguous buffer in memory that stores both data and chunk headers, etc... Increase to 256 bytes. Signed-off-by: Andy Ross <firstname.lastname@example.org>
The sys_mem_pool data structure is going away. And this test case didn't actually do much. All it did was create a sys_mem_pool in the app data section (I guess that's the "mem_protect" part?) and validate that it was usable. We have tests for sys_heap to do that already elsewhere anyway; no point in porting. Signed-off-by: Andy Ross <email@example.com>
This tiny header uses non-builtin types but includes no headers that would define them. Recent header motion seems to have exposed a case where this file can get built before its dependencies are included. Add the header directly. Signed-off-by: Andy Ross <firstname.lastname@example.org>
The mailbox and msgq utilities had API variants that could pass old mem_pool blocks through the data structure. That API is being deprected (and the features were obscure), so remove the internal support. Signed-off-by: Andy Ross <email@example.com>
Remove test cases that exercise the deprecated mem_pool features of the pipe utility. Note that this leaves comparatively few cases left, we should probably audit coverage after this merges and rewrite tests that aren't interdependent. Signed-off-by: Andy Ross <firstname.lastname@example.org>
Use the core k_heap API pervasively within our tree instead of the z_mem_pool wrapper that provided compatibility with the older mempool implementation. Almost all of this is straightforward swapping of one alloc/free call for another. In a few cases where code was holding onto an old-style "mem_block" a local compatibility struct with a single field has been swapped in to keep the invasiveness of the changes down. Note that not all the relevant changes in this patch have in-tree test coverage, though I validated that it all builds. Signed-off-by: Andy Ross <email@example.com>