From: Christoph Lameter <cl@linux-foundation.org>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: akpm@linux-foundation.org, Christoph Lameter <clameter@sgi.com>,
Christoph Lameter <cl@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org
Cc: Mel Gorman <mel@skynet.ie>
Cc: andi@firstfloor.org
Cc: Rik van Riel <riel@redhat.com>
Cc: mpm@selenic.com
Cc: Dave Chinner <david@fromorbit.com>
Subject: [patch 06/19] slub: Add KICKABLE to avoid repeated kick() attempts
Date: Mon, 11 Aug 2008 08:06:22 -0700 [thread overview]
Message-ID: <20080811150656.117393595@quilx.com> (raw)
In-Reply-To: <20080811150616.207532384@quilx.com>
[-- Attachment #1: 0006-SLUB-Add-KICKABLE-to-avoid-repeated-kick-attempts.patch --]
[-- Type: text/plain, Size: 3839 bytes --]
Add a flag KICKABLE to be set on slabs with a defragmentation method
Clear the flag if a kick action is not successful in reducing the
number of objects in a slab. This will avoid future attempts to
kick objects out.
The KICKABLE flag is set again when all objects of the slab have been
allocated (Occurs during removal of a slab from the partial lists).
Reviewed-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
---
include/linux/page-flags.h | 2 ++
mm/slub.c | 23 ++++++++++++++++++-----
2 files changed, 20 insertions(+), 5 deletions(-)
Index: linux-next/mm/slub.c
===================================================================
--- linux-next.orig/mm/slub.c 2008-08-11 07:47:01.482348822 -0700
+++ linux-next/mm/slub.c 2008-08-11 07:50:09.282347574 -0700
@@ -1138,6 +1138,9 @@ static struct page *new_slab(struct kmem
SLAB_STORE_USER | SLAB_TRACE))
__SetPageSlubDebug(page);
+ if (s->kick)
+ __SetPageSlubKickable(page);
+
start = page_address(page);
if (unlikely(s->flags & SLAB_POISON))
@@ -1181,6 +1184,7 @@ static void __free_slab(struct kmem_cach
NR_SLAB_RECLAIMABLE : NR_SLAB_UNRECLAIMABLE,
-pages);
+ __ClearPageSlubKickable(page);
__ClearPageSlab(page);
reset_page_mapcount(page);
__free_pages(page, order);
@@ -1391,6 +1395,8 @@ static void unfreeze_slab(struct kmem_ca
if (SLABDEBUG && PageSlubDebug(page) &&
(s->flags & SLAB_STORE_USER))
add_full(n, page);
+ if (s->kick)
+ __SetPageSlubKickable(page);
}
slab_unlock(page);
} else {
@@ -2820,12 +2826,12 @@ static int kmem_cache_vacate(struct page
slab_lock(page);
BUG_ON(!PageSlab(page)); /* Must be s slab page */
- BUG_ON(!SlabFrozen(page)); /* Slab must have been frozen earlier */
+ BUG_ON(!PageSlubFrozen(page)); /* Slab must have been frozen earlier */
s = page->slab;
objects = page->objects;
map = scratch + objects * sizeof(void **);
- if (!page->inuse || !s->kick)
+ if (!page->inuse || !s->kick || !PageSlubKickable(page))
goto out;
/* Determine used objects */
@@ -2863,6 +2869,9 @@ out:
* Check the result and unfreeze the slab
*/
leftover = page->inuse;
+ if (leftover)
+ /* Unsuccessful reclaim. Avoid future reclaim attempts. */
+ __ClearPageSlubKickable(page);
unfreeze_slab(s, page, leftover > 0);
local_irq_restore(flags);
return leftover;
@@ -2924,17 +2933,21 @@ static unsigned long __kmem_cache_shrink
continue;
if (page->inuse) {
- if (page->inuse * 100 >=
+ if (!PageSlubKickable(page) || page->inuse * 100 >=
s->defrag_ratio * page->objects) {
slab_unlock(page);
- /* Slab contains enough objects */
+ /*
+ * Slab contains enough objects
+ * or we alrady tried reclaim before and
+ * it failed. Skip this one.
+ */
continue;
}
list_move(&page->lru, &zaplist);
if (s->kick) {
n->nr_partial--;
- SetSlabFrozen(page);
+ __SetPageSlubFrozen(page);
}
slab_unlock(page);
} else {
Index: linux-next/include/linux/page-flags.h
===================================================================
--- linux-next.orig/include/linux/page-flags.h 2008-08-11 07:42:31.882358716 -0700
+++ linux-next/include/linux/page-flags.h 2008-08-11 07:47:01.612357581 -0700
@@ -112,6 +112,7 @@ enum pageflags {
/* SLUB */
PG_slub_frozen = PG_active,
PG_slub_debug = PG_error,
+ PG_slub_kickable = PG_dirty,
};
#ifndef __GENERATING_BOUNDS_H
@@ -182,6 +183,7 @@ __PAGEFLAG(SlobFree, slob_free)
__PAGEFLAG(SlubFrozen, slub_frozen)
__PAGEFLAG(SlubDebug, slub_debug)
+__PAGEFLAG(SlubKickable, slub_kickable)
/*
* Only test-and-set exist for PG_writeback. The unconditional operators are
--
next prev parent reply other threads:[~2008-08-11 15:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-11 15:06 [patch 00/19] Slab Fragmentation Reduction V14 Christoph Lameter
2008-08-11 15:06 ` [patch 01/19] slub: Add defrag_ratio field and sysfs support Christoph Lameter
2008-08-13 0:40 ` Greg KH
2008-08-11 15:06 ` [patch 02/19] slub: Replace ctor field with ops field in /sys/slab/* Christoph Lameter
2008-08-11 15:06 ` [patch 03/19] slub: Add get() and kick() methods Christoph Lameter
2008-08-11 15:06 ` [patch 04/19] slub: Sort slab cache list and establish maximum objects for defrag slabs Christoph Lameter
2008-08-11 15:06 ` [patch 05/19] slub: Slab defrag core Christoph Lameter
2008-08-11 15:06 ` Christoph Lameter [this message]
2008-08-11 15:06 ` [patch 07/19] slub: Extend slabinfo to support -D and -F options Christoph Lameter
2008-08-11 15:06 ` [patch 08/19] slub/slabinfo: add defrag statistics Christoph Lameter
2008-08-11 15:06 ` [patch 09/19] slub: Trigger defragmentation from memory reclaim Christoph Lameter
2008-08-11 15:06 ` [patch 10/19] buffer heads: Support slab defrag Christoph Lameter
2008-08-11 15:06 ` [patch 11/19] inodes: Support generic defragmentation Christoph Lameter
2008-08-11 15:06 ` [patch 12/19] Filesystem: Ext2 filesystem defrag Christoph Lameter
2008-08-11 15:06 ` [patch 13/19] Filesystem: Ext3 " Christoph Lameter
2008-08-11 15:06 ` [patch 14/19] Filesystem: Ext4 " Christoph Lameter
2008-08-11 15:06 ` [patch 15/19] Filesystem: XFS slab defragmentation Christoph Lameter
2008-08-12 0:20 ` Dave Chinner
2008-08-12 7:08 ` Pekka Enberg
2008-08-12 18:21 ` Christoph Lameter
2008-08-13 6:38 ` Pekka Enberg
2008-08-11 15:06 ` [patch 16/19] Filesystem: /proc filesystem support for slab defrag Christoph Lameter
2008-08-11 15:06 ` [patch 17/19] Filesystem: Slab defrag: Reiserfs support Christoph Lameter
2008-08-11 15:06 ` [patch 18/19] dentries: Add constructor Christoph Lameter
2008-08-13 7:12 ` Pekka Enberg
2008-08-11 15:06 ` [patch 19/19] dentries: dentry defragmentation Christoph Lameter
2008-08-12 6:50 ` [patch 00/19] Slab Fragmentation Reduction V14 Pekka Enberg
-- strict thread matches above, loose matches on Subject: below --
2008-05-10 2:21 [patch 00/19] Slab Fragmentation Reduction V13 Christoph Lameter
2008-05-10 2:21 ` [patch 06/19] slub: Add KICKABLE to avoid repeated kick() attempts Christoph Lameter
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=20080811150656.117393595@quilx.com \
--to=cl@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=clameter@sgi.com \
--cc=penberg@cs.helsinki.fi \
/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®