From: Mark Bellon <mbellon@mvista.com>
To: linux-kernel@vger.kernel.org, marcelo@logos.cnet
Subject: PATCH (2.4.x) - Interrupts disabled for a long time
Date: Thu, 06 Nov 2003 09:45:49 -0700 [thread overview]
Message-ID: <3FAA7ABD.9050804@mvista.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 307 bytes --]
While running some file system and NFS benchmarks I noticed that
interrupts were being diabled for long periods of time (up to 625+ us on
my 1.6 Ghz Xeon). The culprit was in kmem_cache_reap.
This is a 2.6 inspired, minimally invasive patch that fixes the problem
(nothing longer than 40 us now).
mark
[-- Attachment #2: slab-2-patch --]
[-- Type: text/plain, Size: 3047 bytes --]
Index: slab.c
===================================================================
RCS file: /cvsdev/mvl-kernel/linux/mm/slab.c,v
retrieving revision 1.8.6.1.6.1
diff -a -u -r1.8.6.1.6.1 slab.c
--- slab.c 22 Aug 2003 23:26:57 -0000 1.8.6.1.6.1
+++ slab.c 5 Nov 2003 23:42:42 -0000
@@ -194,6 +194,7 @@
struct list_head slabs_full;
struct list_head slabs_partial;
struct list_head slabs_free;
+ unsigned int slab_free_count;
unsigned int objsize;
unsigned int flags; /* constant flags */
unsigned int num; /* # of objs per slab */
@@ -359,6 +360,7 @@
slabs_full: LIST_HEAD_INIT(cache_cache.slabs_full),
slabs_partial: LIST_HEAD_INIT(cache_cache.slabs_partial),
slabs_free: LIST_HEAD_INIT(cache_cache.slabs_free),
+ slab_free_count:0,
objsize: sizeof(kmem_cache_t),
flags: SLAB_NO_REAP,
spinlock: SPIN_LOCK_UNLOCKED,
@@ -791,6 +793,7 @@
INIT_LIST_HEAD(&cachep->slabs_full);
INIT_LIST_HEAD(&cachep->slabs_partial);
INIT_LIST_HEAD(&cachep->slabs_free);
+ cachep->slab_free_count = 0;
if (flags & CFLGS_OFF_SLAB)
cachep->slabp_cache = kmem_find_general_cachep(slab_size,0);
@@ -936,6 +939,7 @@
BUG();
#endif
list_del(&slabp->list);
+ cachep->slab_free_count--;
spin_unlock_irq(&cachep->spinlock);
conditional_schedule();
@@ -1190,6 +1194,7 @@
/* Make slab active. */
list_add_tail(&slabp->list, &cachep->slabs_free);
+ cachep->slab_free_count++;
STATS_INC_GROWN(cachep);
cachep->failures = 0;
@@ -1298,6 +1303,7 @@
if (unlikely(entry == slabs_free)) \
goto alloc_new_slab; \
list_del(entry); \
+ cachep->slab_free_count--; \
list_add(entry, slabs_partial); \
} \
\
@@ -1324,6 +1330,7 @@
if (unlikely(entry == slabs_free))
break;
list_del(entry);
+ cachep->slab_free_count--;
list_add(entry, slabs_partial);
}
@@ -1466,6 +1473,7 @@
/* Was partial or full, now empty. */
list_del(&slabp->list);
list_add(&slabp->list, &cachep->slabs_free);
+ cachep->slab_free_count++;
} else if (unlikely(inuse == cachep->num)) {
/* Was full. */
list_del(&slabp->list);
@@ -1762,7 +1770,6 @@
searchp = clock_searchp;
do {
unsigned int pages;
- struct list_head* p;
unsigned int full_free;
/* It's safe to test this without holding the cache-lock. */
@@ -1785,18 +1792,29 @@
}
#endif
+#if DEBUG
+{
+ struct list_head* p;
+
full_free = 0;
p = searchp->slabs_free.next;
while (p != &searchp->slabs_free) {
slabp = list_entry(p, slab_t, list);
-#if DEBUG
+
if (slabp->inuse)
BUG();
-#endif
+
full_free++;
p = p->next;
}
+ if (full_free != searchp->slab_free_count)
+ BUG();
+}
+#else
+ full_free = searchp->slab_free_count;
+#endif
+
/*
* Try to avoid slabs with constructors and/or
* more than one page per slab (as it can be difficult
@@ -1847,6 +1865,7 @@
BUG();
#endif
list_del(&slabp->list);
+ best_cachep->slab_free_count--;
STATS_INC_REAPED(best_cachep);
/* Safe to drop the lock. The slab is no longer linked to the
reply other threads:[~2003-11-06 16:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3FAA7ABD.9050804@mvista.com \
--to=mbellon@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@logos.cnet \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.