[Crash-utility] Re: when tracking full slabs, check kmem_cache flag

Dave Anderson anderson at redhat.com
Mon Mar 17 18:40:19 UTC 2008


i-kitayama at ap.jp.nec.com wrote:
> Hi Dave,
> Users who want to track full slabs (on systmes using the
> SLUB allocator), the flag SLAB_STORE_USER also needs to be set
> or add_full() never invoked.
> I have attached a patch not to echo an empty message
> when only slub debug is set, could you take a look at it?
> The patch is for crash-4.0-6.1, tested on a Fedora 8 box
> (2.6.24.3-12.fc8)
> 
> Thanks,
> 
> Itaru

Hi Itaru,

I confused about the logic of your patch.

In 2.6.22, the kmem_cache_node was declared like so:

struct kmem_cache_node {
         spinlock_t list_lock;   /* Protect partial list and nr_partial */
         unsigned long nr_partial;
         atomic_long_t nr_slabs;
         struct list_head partial;
         struct list_head full;
};

In 2.6.23 and above, it is declared like so:

struct kmem_cache_node {
         spinlock_t list_lock;   /* Protect partial list and nr_partial */
         unsigned long nr_partial;
         atomic_long_t nr_slabs;
         struct list_head partial;
#ifdef CONFIG_SLUB_DEBUG
         struct list_head full;
#endif
};

Your patch does this:

--- a/memory.c
+++ b/memory.c
@@ -13745,8 +13745,11 @@ do_node_lists_slub(struct meminfo *si, ulong node_ptr, 
int node)
                      "page.lru.next", RETURN_ON_ERROR))
                          return;
          }
-
-       if (INVALID_MEMBER(kmem_cache_node_full)) {
+       #define SLAB_STORE_USER (0x00010000UL)
+       ulong flags = ULONG(si->cache_buf);
+
+       if (INVALID_MEMBER(kmem_cache_node_full) &&
+           !(flags & SLAB_STORE_USER)) {
                 fprintf(fp, "NODE %d FULL:\n  (not tracked)\n", node);
                 return;
         }


For 2.6.22 only, kmem_cache_node.full is always there, so in that
case, the SLAB_STORE_USER flag would never get checked above, and
the full slab would be shown as "(empty)".

And for 2.6.23 kernels and above, the SLAB_STORE_USER flag
would *only* be checked if CONFIG_SLUB_DEBUG was *not* set.
And if CONFIG_SLUB_DEBUG is not set, then full slabs would not
be tracked because add_full() is a no-op -- regardless whether
the SLAB_STORE_USER flag was set or not.

Shouldn't it be "||" instead of "&&"?

Dave






More information about the Crash-utility mailing list