Re: [PATCH 2/3] slub: Use new node functions

Christoph Lameter
2014-06-13T16:02:43Z

On Wed, 11 Jun 2014, David Rientjes wrote:

> > + for_each_kmem_cache_node(s, node, n) {
> >
> > free_partial(s, n);
> > if (n->nr_partial || slabs_node(s, node))
>
> Newline not removed?

Ok got through the file and removed all the lines after
for_each_kmem_cache_node.

>
> > @@ -3407,11 +3401,7 @@ int __kmem_cache_shrink(struct kmem_cach
> > return -ENOMEM;
> >
> > flush_all(s);
> > - for_each_node_state(node, N_NORMAL_MEMORY) {
> > - n = get_node(s, node);
> > -
> > - if (!n->nr_partial)
> > - continue;
> > + for_each_kmem_cache_node(s, node, n) {
> >
> > for (i = 0; i < objects; i++)
> > INIT_LIST_HEAD(slabs_by_inuse + i);
>
> Is there any reason not to keep the !n->nr_partial check to avoid taking
> n->list_lock unnecessarily?

No this was simply a mistake the check needs to be preserved.

Subject: slub: Fix up earlier patch

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/mm/slub.c
===================================================================
--- linux.orig/mm/slub.c 2014-06-13 10:59:01.815583306 -0500
+++ linux/mm/slub.c 2014-06-13 10:58:45.444109563 -0500
@@ -3216,7 +3216,6 @@ static inline int kmem_cache_close(struc
flush_all(s);
/* Attempt to free all objects */
for_each_kmem_cache_node(s, node, n) {
-
free_partial(s, n);
if (n->nr_partial || slabs_node(s, node))
return 1;
@@ -3402,6 +3401,8 @@ int __kmem_cache_shrink(struct kmem_cach

flush_all(s);
for_each_kmem_cache_node(s, node, n) {
+ if (!n->nr_partial)
+ continue;

for (i = 0; i < objects; i++)
INIT_LIST_HEAD(slabs_by_inuse + i);
@@ -4334,7 +4335,6 @@ static ssize_t show_slab_objects(struct
struct kmem_cache_node *n;

for_each_kmem_cache_node(s, node, n) {
-
if (flags & SO_TOTAL)
x = count_partial(n, count_total);
else if (flags & SO_OBJECTS)
@@ -5324,7 +5324,6 @@ void get_slabinfo(struct kmem_cache *s,
struct kmem_cache_node *n;

for_each_kmem_cache_node(s, node, n) {
-
nr_slabs += node_nr_slabs(n);
nr_objs += node_nr_objs(n);
nr_free += count_partial(n, count_free);