From: Or Gerlitz <ogerlitz@voltaire.com>
To: linux-kernel@vger.kernel.org
Cc: openib-general@openib.org, <open-iscsi@googlegroups.com>
Subject: possible bug in kmem_cache related code
Date: Thu, 27 Apr 2006 11:40:20 +0300 (IDT) [thread overview]
Message-ID: <Pine.LNX.4.44.0604271138370.16357-101000@zuben> (raw)
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2835 bytes --]
With 2.6.17-rc3 I'm running into something which seems as a bug related
to kmem_cache. Doing some allocations/deallocations from a kmem_cache and
later attempting to destroy it yields the following message and trace
============================================================================
slab error in kmem_cache_destroy(): cache `my_cache': Can't free all objects
Call Trace: <ffffffff8106e46b>{kmem_cache_destroy+150}
<ffffffff88204033>{:my_kcache:kcache_cleanup_module+51}
<ffffffff81044cd3>{sys_delete_module+415} <ffffffff8112fb5b>{__up_write+20}
<ffffffff8105d42b>{sys_munmap+91} <ffffffff8100966a>{system_call+126}
Failed to destroy cache
============================================================================
I was hitting it as an Infiniband/iSCSI user as IB/iSCSI/SCSI code use
kmem_caches, but since the failure happens on a code which works fine on
2.6.16 i have decided to try it with a synthetic module and had this hit...
Below is a sample code that reproduces it, if i only do kmem_cache_create
and later destroy it does not happen, attached is my .config please note
that some of the CONFIG_DEBUG_ options are open.
Please CC openib-general@openib.org at least with the resolution of the
matter since it kind of hard to do testing over 2.6.17-rcX with this
issue, the tests run fine but some modules are crashing on rmmod so a
reboot it needed...
thanks,
Or.
This is the related slab info line once the module is loaded
my_cache 256 264 328 12 1 : tunables 32 16 8
: slabdata 22 22 0 : globalstat 264 264 22 0
--- /deb/null 1970-01-01 02:00:00.000000000 +0200
+++ kcache/kcache.c 2006-04-27 10:43:18.000000000 +0300
@@ -0,0 +1,61 @@
+#include <linux/module.h>
+#include <linux/slab.h>
+
+kmem_cache_t *cache;
+
+struct foo {
+ char bar[300];
+};
+
+
+#define TRIES 256
+
+struct foo *foo_arr[TRIES];
+
+static int __init kcache_init_module(void)
+{
+ int i, j;
+
+ cache = kmem_cache_create("my_cache",
+ sizeof (struct foo),
+ 0,
+ SLAB_HWCACHE_ALIGN,
+ NULL,
+ NULL);
+ if (!cache) {
+ printk(KERN_ERR "couldn't create cache\n");
+ goto error1;
+ }
+
+ for (i = 0; i < TRIES; i++) {
+ foo_arr[i] = kmem_cache_alloc(cache, GFP_KERNEL);
+ if (foo_arr[i] == NULL) {
+ printk(KERN_ERR "couldn't allocate from cache\n");
+ goto error2;
+ }
+ }
+
+ return 0;
+error2:
+ for (j = 0; j < i; j++)
+ kmem_cache_free(cache, foo_arr[j]);
+error1:
+ return -ENOMEM;
+}
+
+static void __exit kcache_cleanup_module(void)
+{
+ int i;
+
+ for (i = 0; i < TRIES; i++)
+ kmem_cache_free(cache, foo_arr[i]);
+
+ if (kmem_cache_destroy(cache)) {
+ printk(KERN_DEBUG "Failed to destroy cache\n");
+ }
+}
+
+MODULE_LICENSE("GPL");
+
+module_init(kcache_init_module);
+module_exit(kcache_cleanup_module);
[-- Attachment #2: Type: APPLICATION/x-bzip2, Size: 10879 bytes --]
next reply other threads:[~2006-04-27 8:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 8:40 Or Gerlitz [this message]
2006-04-27 11:19 ` Pekka Enberg
2006-04-27 22:22 ` Christoph Lameter
2006-04-28 6:03 ` Pekka J Enberg
2006-04-28 8:10 ` Pekka J Enberg
2006-04-28 19:24 ` [openib-general] " Or Gerlitz
2006-04-29 6:44 ` Pekka Enberg
2006-05-01 13:40 ` Or Gerlitz
2006-05-03 22:04 ` Ard van Breemen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0604271138370.16357-101000@zuben \
--to=ogerlitz@voltaire.com \
--cc=linux-kernel@vger.kernel.org \
--cc=open-iscsi@googlegroups.com \
--cc=openib-general@openib.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®