From: "Martin K. Petersen" <mkp@wildopensource.com>
To: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org,
akpm@osdl.org, tony.luck@intel.com
Subject: [PATCH] General purpose zeroed page slab
Date: Thu, 14 Oct 2004 16:50:43 +0000 [thread overview]
Message-ID: <yq1oej5s0po.fsf@wilson.mkp.net> (raw)
A while back Bill Irwin converted the page table code on ppc64 to use
a zeroed page slab. I recently did the same on ia64 and got a
significant performance improvement in terms of fault time (4 usec ->
700 nsec).
This cache needs to be initialized fairly early on and so far we've
called it from pgtable_cache_init() on both archs. However, Tony Luck
thought it might be useful to have a general purpose slab cache with
zeroed pages. And other architectures might decide to use it for
their page tables too.
Consequently here's a patch that puts this functionality in slab.c.
Signed-off-by: Martin K. Petersen <mkp@wildopensource.com>
--
Martin K. Petersen Wild Open Source, Inc.
mkp@wildopensource.com http://www.wildopensource.com/
diff -urN -X /usr/people/mkp/bin/dontdiff linux-pristine/include/linux/slab.h zero-slab/include/linux/slab.h
--- linux-pristine/include/linux/slab.h 2004-10-11 14:57:20.000000000 -0700
+++ zero-slab/include/linux/slab.h 2004-10-13 17:49:29.000000000 -0700
@@ -115,6 +115,7 @@
extern kmem_cache_t *signal_cachep;
extern kmem_cache_t *sighand_cachep;
extern kmem_cache_t *bio_cachep;
+extern kmem_cache_t *zero_page_cachep;
extern atomic_t slab_reclaim_pages;
diff -urN -X /usr/people/mkp/bin/dontdiff linux-pristine/mm/slab.c zero-slab/mm/slab.c
--- linux-pristine/mm/slab.c 2004-10-11 14:57:20.000000000 -0700
+++ zero-slab/mm/slab.c 2004-10-13 17:49:57.000000000 -0700
@@ -716,6 +716,13 @@
static struct notifier_block cpucache_notifier = { &cpuup_callback, NULL, 0 };
+kmem_cache_t *zero_page_cachep;
+
+static void zero_page_ctor(void *pte, kmem_cache_t *cache, unsigned long flags)
+{
+ memset(pte, 0, PAGE_SIZE);
+}
+
/* Initialisation.
* Called after the gfp() functions have been enabled, and before smp_init().
*/
@@ -837,6 +844,16 @@
/* The reap timers are started later, with a module init call:
* That part of the kernel is not yet operational.
*/
+
+ /* General purpose cache of zeroed pages */
+ zero_page_cachep = kmem_cache_create("zero_page_cache",
+ PAGE_SIZE, 0,
+ SLAB_HWCACHE_ALIGN |
+ SLAB_MUST_HWCACHE_ALIGN,
+ zero_page_ctor,
+ NULL);
+ if (!zero_page_cachep)
+ panic("could not create zero_page_cache!\n");
}
static int __init cpucache_init(void)
next reply other threads:[~2004-10-14 16:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-14 16:50 Martin K. Petersen [this message]
2004-10-14 17:30 ` [PATCH] General purpose zeroed page slab Brian Gerst
2004-10-14 17:36 ` Matthew Wilcox
2004-10-14 18:49 ` Dave Jones
2004-10-14 19:08 ` Denis Vlasenko
2004-10-14 19:47 ` Matthew Wilcox
2004-10-14 18:04 ` Andi Kleen
2004-10-14 23:36 ` Adam Heath
2004-10-15 1:18 ` Andi Kleen
2004-10-18 18:06 ` Martin K. Petersen
2004-10-18 18:42 ` Matthew Wilcox
2004-10-18 18:54 ` Martin K. Petersen
2004-10-18 19:06 ` Andi Kleen
2004-10-18 21:06 ` Andi Kleen
2004-10-18 19:03 ` Luck, Tony
2004-10-18 19:14 ` Matthew Wilcox
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=yq1oej5s0po.fsf@wilson.mkp.net \
--to=mkp@wildopensource.com \
--cc=akpm@osdl.org \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/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