From: Ed Tomlinson <tomlins@cam.org>
To: Andrew Morton <akpm@zip.com.au>
Cc: linux-mm@kvack.org
Subject: Re: slablru for 2.5.32-mm1
Date: Mon, 2 Sep 2002 11:00:47 -0400 [thread overview]
Message-ID: <200209021100.47508.tomlins@cam.org> (raw)
In-Reply-To: <3D72F675.920DC976@zip.com.au>
On September 2, 2002 01:26 am, Andrew Morton wrote:
> Ed, this code can be sped up a bit, I think. We can make
> kmem_count_page() return a boolean back to shrink_cache(), telling it
> whether it needs to call kmem_do_prunes() at all. Often, there won't
> be any work to do in there, and taking that semaphore can be quite
> costly.
>
> The code as-is will even run kmem_do_prunes() when we're examining
> ZONE_HIGHMEM, which certainly won't have any slab pages. This boolean
> will fix that too.
How about this? I have modified things so we only try for the sem if there
is work to do. It also always uses a down_trylock - if we cannot do the prune
now later is ok too...
Lightly tested.
Comments
Ed
-----------
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.531 -> 1.533
# mm/slab.c 1.28 -> 1.30
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/02 ed@oscar.et.ca 1.532
# optimization. lets only take the sem if we have work to do.
# --------------------------------------------
# 02/09/02 ed@oscar.et.ca 1.533
# more optimizations and a correction
# --------------------------------------------
#
diff -Nru a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c Mon Sep 2 10:54:33 2002
+++ b/mm/slab.c Mon Sep 2 10:54:33 2002
@@ -403,6 +403,9 @@
/* Place maintainer for reaping. */
static kmem_cache_t *clock_searchp = &cache_cache;
+static int pruner_flag;
+#define PRUNE_GATE 0
+
#define cache_chain (cache_cache.next)
#ifdef CONFIG_SMP
@@ -427,6 +430,8 @@
spin_lock_irq(&cachep->spinlock);
if (cachep->pruner != NULL) {
cachep->count += slabp->inuse;
+ if (cachep->count)
+ set_bit(PRUNE_GATE, &pruner_flag);
ret = !slabp->inuse;
} else
ret = !ref && !slabp->inuse;
@@ -441,11 +446,13 @@
struct list_head *p;
int nr;
- if (gfp_mask & __GFP_WAIT)
- down(&cache_chain_sem);
- else
- if (down_trylock(&cache_chain_sem))
- return 0;
+ if (!test_and_clear_bit(PRUNE_GATE, &pruner_flag))
+ return 0;
+
+ if (down_trylock(&cache_chain_sem)) {
+ set_bit(PRUNE_GATE, &pruner_flag);
+ return 0;
+ }
list_for_each(p,&cache_chain) {
kmem_cache_t *cachep = list_entry(p, kmem_cache_t, next);
-----------
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
next prev parent reply other threads:[~2002-09-02 15:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-26 22:09 MM patches against 2.5.31 Ed Tomlinson
2002-08-26 22:09 ` Ed Tomlinson
2002-08-26 23:58 ` Andrew Morton
2002-08-26 23:58 ` Andrew Morton
2002-08-27 0:13 ` Rik van Riel
2002-08-27 0:13 ` Rik van Riel
2002-08-28 17:06 ` slablru for 2.5.32-mm1 Ed Tomlinson
2002-08-28 21:24 ` Andrew Morton
2002-08-28 22:23 ` Rik van Riel
2002-09-02 5:26 ` Andrew Morton
2002-09-02 15:00 ` Ed Tomlinson [this message]
2002-09-02 18:35 ` Andrew Morton
2002-09-02 19:09 ` Ed Tomlinson
2002-09-02 19:51 ` Andrew Morton
2002-09-02 6:50 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2002-08-28 22:11 Ed Tomlinson
2002-09-06 4:07 Craig Kulesa
2002-09-06 4:24 ` Robert Love
2002-09-08 21:43 ` Daniel Phillips
2002-09-09 4:36 ` Robert Love
2002-09-09 5:10 ` Daniel Phillips
2002-09-06 4:38 ` Andrew Morton
2002-09-06 11:39 ` Ed Tomlinson
2002-09-06 18:57 ` Craig Kulesa
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=200209021100.47508.tomlins@cam.org \
--to=tomlins@cam.org \
--cc=akpm@zip.com.au \
--cc=linux-mm@kvack.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 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.