casaroli opened a new pull request, #20629:
URL: https://github.com/apache/nuttx/pull/20629

   ## Summary
   
   When a range of granules is not free, `gran_match()` gives `gran_search()` a 
position to continue from. Since commit 1abcb6a0905 it reads the whole GAT cell 
again for this and uses the highest used bit of the cell, not of the range. A 
used bit above the range moves the search past all of the free granules below 
it.
   
   Example: a cell with only bits 0 and 31 used is never searched again. In a 
page pool under load, `gran_alloc()` for one page returned NULL with about 
34000 pages free.
   
   This PR uses the masked cell value again, as before commit 1abcb6a0905.
   
   ## Impact
   
   `mm_gran` (`gran_alloc()`, and the page allocator of `CONFIG_MM_PGALLOC`). 
Allocations that failed with free granules available now succeed. No API change.
   
   ## Testing
   
   Host test: `mm/mm_gran/mm_grantable.c` compiled on Linux (Docker) and 
compared with a brute-force search on 200000 random GAT tables and some fixed 
cases.
   
   ```
   master:  gran_search(1) = -12, expect 1  FAIL
            gran_search(17) = -12, expect 37  FAIL
            FAILED (33942 failures)
   this PR: PASSED (0 failures)
   ```
   
   Build: `qemu-armv8a:nsh` and `qemu-armv8a:knsh`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to