Hi Liam, thanks for your reply.
version 6.1 or 6.1.x? Which exact version (git id or version number) Our environment is kernel-6.1.25-mainline-android14-5-gdea04bf2c398d.
This BUG_ON() is necessary since this function should _never_ run out ofmemory; this function does not return an error code. mas_preallocate()should have gotten you the memory necessary (or returned an -ENOMEM)prior to the call to mas_store_prealloc(), so this is probably aninternal tree problem. There is a tree operation being performed here. mprotect is merging avma by the looks of the call stack. Why do you think no tree operationis necessary? As you mentioned, mas_preallocate() should allocate enough node, but there is such functions mas_node_count() in mas_store_prealloc().
In mas_node_count() checks whether the *mas* has enough nodes, and allocate memory for node if there was no enough nodes in mas.
I think that if mas_preallocate() allocate enough node, why we check the node count and allocate nodes if there was no enough nodes in mas in mas_node_count()?
We have seen that there may be some maple_tree operations in merge_vma...
Moreover, would maple_tree provides an API for assigning user's gfp flag for allocating node?
In rb_tree, we allocate vma_area_struct (rb_node is in this struct.) with GFP_KERNEL, and maple_tree allocate node with GFP_NOWAIT and __GFP_NOWARN.
Allocation will not wait for reclaiming and compacting when there is no enough available memory.
Is there any concern for this design?
I see this is arm64. Do you have a reproducer? If you don't have areproducer, I can try stress-ng on amr64 to simulate your workload usingmprotect, but I need to know the exact kernel version as this issue mayhave been fixed in a later stable release. It is offen occur under low memory condiction. Maybe you can try stress-ng on arm64 under high memory stress(e.g. reserved lots of memory).
BRs,
John Hsu
internal tree problem.On Tue, 2023-06-13 at 10:11 -0400, Liam R. Howlett wrote:
|