This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new fb5d0f61f3e mm/mm_gran: Do not skip free granules below a used bit 
outside the range.
fb5d0f61f3e is described below

commit fb5d0f61f3e586b56eb4a9a612a4d707ba4ef75c
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)

Reply via email to