mbox series

[0/3] mm/slub: Fix slabs_node return value

Message ID 20200614123923.99189-1-songmuchun@bytedance.com (mailing list archive)
Headers show
Series mm/slub: Fix slabs_node return value | expand

Message

Muchun Song June 14, 2020, 12:39 p.m. UTC
The slabs_node() always return zero when CONFIG_SLUB_DEBUG is disabled.
But some codes determine whether slab is empty by checking the return
value of slabs_node(). As you know, the result is not correct. we move
the nr_slabs of kmem_cache_node out of the CONFIG_SLUB_DEBUG. So we can
get the corrent value returned by the slabs_node().

Muchun Song (3):
  mm/slub: Fix slabs_node return value when CONFIG_SLUB_DEBUG disabled
  mm/slub: Use node_nr_slabs() instead of slabs_node()
  mm/slub: Fix release all resources used by a slab cache

 mm/slab.h |  2 +-
 mm/slub.c | 93 +++++++++++++++++++++++++++++++++------------------------------
 2 files changed, 50 insertions(+), 45 deletions(-)

Comments

Christoph Lameter (Ampere) June 17, 2020, 4:19 p.m. UTC | #1
On Sun, 14 Jun 2020, Muchun Song wrote:

> The slabs_node() always return zero when CONFIG_SLUB_DEBUG is disabled.
> But some codes determine whether slab is empty by checking the return
> value of slabs_node(). As you know, the result is not correct. we move
> the nr_slabs of kmem_cache_node out of the CONFIG_SLUB_DEBUG. So we can
> get the corrent value returned by the slabs_node().

Not that all distribution kernels have CONFIG_SLUB_DEBUG enabled. This
does not enable runtime debugging but only compiles the debug code in that
can then be enabled at runtime.

Users of !CONFIG_SLUB_DEBUG do not want to have the debug code included
because they have extreme requirements on memory use.

This patch increases use of memory by enabling fields that were excluded
under !CONFIG_SLUB_DEBUG before!

There is nothing wrong with slab_node's return value if one wants to
sacrifice debugging and consistency checks for a small code build.