Re: [PATCH] mm/slab: improve kmem_cache_alloc_bulk

"Vlastimil Babka (SUSE)" <[email protected]>
Newsgroups org.kernel.vger.io-uring,org.freedesktop.lists.dri-devel,org.kernel.vger.bpf,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.kvack.linux-mm
Message-ID <[email protected]>
On 6/3/26 13:13, Rob Clark wrote:
> On Wed, Jun 3, 2026 at 2:17 AM Vlastimil Babka (SUSE) <[email protected]> wrote:
>>
>> We know p->pages is NULL in this case, right? Because it was allocated by
>> vm_bind_job_create() using kzalloc().
>> And the job can't be reused with a leftover value?
>> (msm_iommu_pagetable_prealloc_cleanup doesn't set p->pages to zero).
>> Or should we set p->pages to NULL here.
> 
> Correct, the job is not reused.  But I suppose setting p->pages to
> NULL would make things more obvious, so no objection to that.

OK, did that, just in case. Thanks.

> BR,
> -R
> 
>> > +
>> >         p->pages = kvmalloc_objs(*p->pages, p->count);
>> >         if (!p->pages)
>> >                 return -ENOMEM;
>> >
>> >         ret = kmem_cache_alloc_bulk(pt_cache, GFP_KERNEL, p->count, p->pages);
>> >         if (ret != p->count) {
>> > -               kfree(p->pages);
>> > +               kvfree(p->pages);
>> >                 p->pages = NULL;
>> >                 p->count = ret;
>> >                 return -ENOMEM;
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.