From: Eric Sandeen <sandeen@sgi.com>
To: linux-kernel@vger.kernel.org
Subject: [RFC] kmem_cache_zalloc
Date: 27 Mar 2002 13:39:17 -0600 [thread overview]
Message-ID: <1017257958.16305.168.camel@stout.americas.sgi.com> (raw)
In the interest of whittling down the changes that XFS makes to the core
kernel, I thought I'd start throwing out some the easier self-contained
modifications for discussion.
XFS adds a kmem_cache_zalloc function to mm/slab.c, it does what you
might expect: kmem_cache_alloc + memset
Is this something that might be considered for inclusion in the core
kernel, or should we roll it back into fs/xfs?
Thanks,
-Eric
--- 18.1/mm/slab.c Fri, 07 Dec 2001 09:35:49 +1100 kaos (linux-2.4/j/5_slab.c 1.2.1.2.1.2.1.3.1.3 644)
+++ 18.11/mm/slab.c Mon, 07 Jan 2002 13:27:25 +1100 kaos (linux-2.4/j/5_slab.c 1.2.1.2.1.7 644)
@@ -1567,6 +1567,23 @@ void kmem_cache_free (kmem_cache_t *cach
local_irq_restore(flags);
}
+void *
+kmem_cache_zalloc(kmem_cache_t *cachep, int flags)
+{
+ void *ptr;
+ ptr = __kmem_cache_alloc(cachep, flags);
+ if (ptr)
+#if DEBUG
+ memset(ptr, 0, cachep->objsize -
+ (cachep->flags & SLAB_RED_ZONE ? 2*BYTES_PER_WORD : 0));
+#else
+ memset(ptr, 0, cachep->objsize);
+#endif
+
+ return ptr;
+}
+
+
--
Eric Sandeen XFS for Linux http://oss.sgi.com/projects/xfs
sandeen@sgi.com SGI, Inc.
next reply other threads:[~2002-03-27 19:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-27 19:39 Eric Sandeen [this message]
2002-03-27 19:47 ` Andrew Morton
2002-03-27 19:52 ` Tigran Aivazian
2002-03-27 20:17 ` Alan Cox
2002-03-29 22:17 ` Pavel Machek
2002-03-29 23:21 ` Alan Cox
2002-03-27 20:19 ` Christoph Hellwig
2002-03-27 20:23 ` Jeff Garzik
2002-03-28 11:21 Dipankar Sarma
2002-03-28 11:25 ` David Woodhouse
2002-03-28 11:40 ` Dipankar Sarma
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=1017257958.16305.168.camel@stout.americas.sgi.com \
--to=sandeen@sgi.com \
--cc=linux-kernel@vger.kernel.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®