On Friday, 2 October 2026 at 17:26:05 CEST, Tom Rini wrote:
[...]
> > +      size = PAD_TO_BLOCKSIZE(count, desc);
> > +
> >        /* Allocate memory for PTE, remember to FREE */
> > -      if (count != 0) {
> > -              pte = memalign(ARCH_DMA_MINALIGN,
> > -                             PAD_TO_BLOCKSIZE(count, desc));
> > +      if (CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)) {
> > +              /*
> > +               * The simple malloc has a no-op free(): keep one
> > +               * buffer and reuse it. The entries are re-read on
> > +               * every call, so the buffer is device- and LBA-agnostic.
> > +               */
> > +              static gpt_entry *cache;
> > +              static size_t cache_size;
> > +
> > +              if (cache && cache_size == size) {
> > +                      pte = cache;
> > +              } else {
> > +                      pte = memalign(ARCH_DMA_MINALIGN, size);
> > +                      cache = pte;
> > +                      cache_size = size;
> > +              }
> > +      } else {
> > +              pte = memalign(ARCH_DMA_MINALIGN, size);
> >        }
> >  
> >        if (count == 0 || pte == NULL) {
> 
> This doesn't seem identical in the non-SPL case, since now pte is always
> assigned. Or am I missing something?
> 
I did overlook the count==0 case, will fix that.

-- 
Benoît


Reply via email to