From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: netdev@vger.kernel.org, linux-mm@kvack.org
Cc: David Miller <davem@davemloft.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [RFC][PATCH 5/6] slab: kmem_cache_objs_to_pages()
Date: Thu, 30 Nov 2006 11:14:56 +0100 [thread overview]
Message-ID: <20061130101922.175620000@chello.nl> (raw)
In-Reply-To: <20061130101451.495412000@chello.nl>
[-- Attachment #1: kmem_cache_objs_to_pages.patch --]
[-- Type: text/plain, Size: 1625 bytes --]
Provide a method to calculate the number of pages used by a given number of
slab objects.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/slab.h | 1 +
mm/slab.c | 6 ++++++
2 files changed, 7 insertions(+)
Index: linux-2.6-git/include/linux/slab.h
===================================================================
--- linux-2.6-git.orig/include/linux/slab.h 2006-11-27 10:46:44.000000000 +0100
+++ linux-2.6-git/include/linux/slab.h 2006-11-27 10:47:33.000000000 +0100
@@ -209,6 +209,7 @@ static inline void *kcalloc(size_t n, si
extern void kfree(const void *);
extern unsigned int ksize(const void *);
extern int slab_is_available(void);
+extern unsigned int kmem_cache_objs_to_pages(struct kmem_cache *, int);
#ifdef CONFIG_NUMA
extern void *kmem_cache_alloc_node(kmem_cache_t *, gfp_t flags, int node);
Index: linux-2.6-git/mm/slab.c
===================================================================
--- linux-2.6-git.orig/mm/slab.c 2006-11-27 10:47:26.000000000 +0100
+++ linux-2.6-git/mm/slab.c 2006-11-27 10:47:54.000000000 +0100
@@ -4279,3 +4279,9 @@ unsigned int ksize(const void *objp)
return obj_size(virt_to_cache(objp));
}
+
+unsigned int kmem_cache_objs_to_pages(struct kmem_cache *cachep, int nr)
+{
+ return ((nr + cachep->num - 1) / cachep->num) << cachep->gfporder;
+}
+EXPORT_SYMBOL_GPL(kmem_cache_objs_to_pages);
--
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2006-11-30 10:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 10:14 [RFC][PATCH 0/6] VM deadlock avoidance -v9 Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 1/6] mm: slab allocation fairness Peter Zijlstra
2006-11-30 18:52 ` Christoph Lameter
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 19:33 ` Christoph Lameter
2006-11-30 19:33 ` Peter Zijlstra
2006-12-01 11:28 ` Peter Zijlstra
2006-11-30 19:02 ` Peter Zijlstra
2006-11-30 19:37 ` Christoph Lameter
2006-11-30 19:40 ` Peter Zijlstra
2006-11-30 20:11 ` Christoph Lameter
2006-11-30 20:15 ` Peter Zijlstra
2006-11-30 20:29 ` Christoph Lameter
2006-11-30 10:14 ` [RFC][PATCH 2/6] mm: allow PF_MEMALLOC from softirq context Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 3/6] mm: serialize access to min_free_kbytes Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 4/6] mm: emergency pool and __GFP_EMERGENCY Peter Zijlstra
2006-11-30 10:14 ` Peter Zijlstra [this message]
2006-11-30 18:55 ` [RFC][PATCH 5/6] slab: kmem_cache_objs_to_pages() Christoph Lameter
2006-11-30 18:55 ` Peter Zijlstra
2006-11-30 19:06 ` Christoph Lameter
2006-11-30 19:03 ` Peter Zijlstra
2006-12-01 12:14 ` Peter Zijlstra
2006-11-30 10:14 ` [RFC][PATCH 6/6] net: vm deadlock avoidance core Peter Zijlstra
2006-11-30 12:04 ` Peter Zijlstra
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=20061130101922.175620000@chello.nl \
--to=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--cc=linux-mm@kvack.org \
--cc=netdev@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