This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.1
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.1 by this push:
new 7ef1d2c689a mm/mm_gran: Do not skip free granules below a used bit
outside the range.
7ef1d2c689a is described below
commit 7ef1d2c689adefad396f73cb220ec65b4acd895d
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Oct 12 15:16:57 2026 +0200
mm/mm_gran: Do not skip free granules below a used bit outside the range.
When a range is not free, gran_match() read the whole GAT cell again and
gave the search its highest used bit. A used bit above the range moved
the search past all of the free granules below it. A cell with bits 0
and 31 used was never searched again, so gran_alloc() returned NULL with
thousands of granules free.
Use the masked cell value, as before commit 1abcb6a0905.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
mm/mm_gran/mm_grantable.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/mm_gran/mm_grantable.c b/mm/mm_gran/mm_grantable.c
index 70c61786b3e..b82fbb2a06e 100644
--- a/mm/mm_gran/mm_grantable.c
+++ b/mm/mm_gran/mm_grantable.c
@@ -225,7 +225,10 @@ failure:
{
size_t tmp;
- v = gran->gat[c];
+ /* v holds only the used bits inside the range. A used bit above the
+ * range must not move the search past the free bits below it.
+ */
+
DEBUGASSERT(v);
if (v == GATCFULL)