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

   ## Summary                                                                   
  
                                                                                
  
   Fix the pool selection logic in multiple mempool lookup for non-linear pool  
  
   size classes.                                                                
  
                                                                                
  
   For multiple mempools without a fixed arithmetic size delta, the lookup uses 
a 
   binary search to find the first pool that can satisfy the requested 
allocation 
   size. The previous comparison only accepted pools whose block size was 
strictly
   greater than the requested size, so an exact-size request skipped the 
matching 
   pool and selected the next larger pool instead.                              
  
                                                                                
  
   This changes the binary search condition from `>` to `>=`, making it a 
proper  
   lower-bound lookup. Exact-size requests are now served by the matching pool. 
  
                                                                                
  
   ## Impact                                                                    
  
                                                                                
  
   This fixes allocation behavior for multiple mempools using non-linear block  
  
   sizes.                                                                       
  
                                                                                
  
   Expected impact:                                                             
  
                                                                                
  
   - exact-size allocation requests use the correctly matching pool             
  
   - avoids unnecessary use of the next larger pool                             
  
   - reduces internal waste for exact-size requests                             
  
   - preserves existing behavior for requests between two pool sizes            
  
   - no API, ABI, build-system, documentation, or security impact is expected   
  
                                                                                
  
   ## Testing                                                                   
  
   
   sim/nsh


-- 
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