On Wed, Aug 11, 2021 at 8:40 PM Vlastimil Babka <vbabka@xxxxxxx> wrote: > > On 8/11/21 1:19 PM, Muchun Song wrote: > > The commit d6e0b7fa1186 ("slub: make dead caches discard free slabs > > immediately") introduced those logic to speed up the destruction of > > per-memcg kmem caches, because kmem caches created for a memory > > cgroup are only destroyed after the last page charged to the cgroup > > is freed at that time. But since commit 9855609bde03 ("mm: memcg/slab: > > use a single set of kmem_caches for all accounted allocations), we > > do not have per-memcg kmem caches anymore. Are those code pointless? > > No, the kmem_cache->cpu_partial can be set to zero by 'echo 0 > /sys/ > > kernel/slab/*/cpu_partial'. In this case, the slab page will be put > > into cpu partial list and then moved to node list (because > > slub_cpu_partial() returns zero). However, we can skip putting the > > slab page to cpu partial list and just move it to node list directly. > > We can adjust the condition of kmem_cache_has_cpu_partial() to > > slub_cpu_partial() in __slab_free() and remove those code from > > put_cpu_partial() for simplification. > > > > Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx> > > Please check again current mmotm/next if this still applies, I think it > shouldn't anymore. Thanks. > You are right. I didn't see it before. I guess it was merged recently. But thanks for your reminder.