LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org
Cc: David Miller <davem@davemloft.net>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 8/9] slab: kmem_cache_objs_to_pages()
Date: Tue, 16 Jan 2007 10:46:05 +0100 [thread overview]
Message-ID: <20070116101815.999600000@taijtu.programming.kicks-ass.net> (raw)
In-Reply-To: <20070116094557.494892000@taijtu.programming.kicks-ass.net>
[-- Attachment #1: kmem_cache_objs_to_pages.patch --]
[-- Type: text/plain, Size: 1426 bytes --]
Provide a method to calculate the number of pages needed to store a given
number of slab objects (upper bound when considering possible partial and
free slabs).
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 2007-01-09 11:28:32.000000000 +0100
+++ linux-2.6-git/include/linux/slab.h 2007-01-09 11:30:16.000000000 +0100
@@ -43,6 +43,7 @@ typedef struct kmem_cache kmem_cache_t _
*/
void __init kmem_cache_init(void);
extern int slab_is_available(void);
+extern unsigned int kmem_cache_objs_to_pages(struct kmem_cache *, int);
struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
unsigned long,
Index: linux-2.6-git/mm/slab.c
===================================================================
--- linux-2.6-git.orig/mm/slab.c 2007-01-09 11:30:00.000000000 +0100
+++ linux-2.6-git/mm/slab.c 2007-01-09 11:30:16.000000000 +0100
@@ -4482,3 +4482,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);
--
next prev parent reply other threads:[~2007-01-16 10:28 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-16 9:45 [PATCH 0/9] VM deadlock avoidance -v10 Peter Zijlstra
2007-01-16 9:45 ` [PATCH 1/9] mm: page allocation rank Peter Zijlstra
2007-01-16 9:45 ` [PATCH 2/9] mm: slab allocation fairness Peter Zijlstra
2007-01-16 9:46 ` [PATCH 3/9] mm: allow PF_MEMALLOC from softirq context Peter Zijlstra
2007-01-16 9:46 ` [PATCH 4/9] mm: serialize access to min_free_kbytes Peter Zijlstra
2007-01-16 9:46 ` [PATCH 5/9] mm: emergency pool Peter Zijlstra
2007-01-16 9:46 ` [PATCH 6/9] mm: __GFP_EMERGENCY Peter Zijlstra
2007-01-16 9:46 ` [PATCH 7/9] mm: allow mempool to fall back to memalloc reserves Peter Zijlstra
2007-01-16 9:46 ` Peter Zijlstra [this message]
2007-01-16 9:46 ` [PATCH 9/9] net: vm deadlock avoidance core Peter Zijlstra
2007-01-16 13:25 ` Evgeniy Polyakov
2007-01-16 13:47 ` Peter Zijlstra
2007-01-16 15:33 ` Evgeniy Polyakov
2007-01-16 16:08 ` Peter Zijlstra
2007-01-17 4:54 ` Evgeniy Polyakov
2007-01-17 9:07 ` Peter Zijlstra
2007-01-18 10:41 ` Evgeniy Polyakov
2007-01-18 12:18 ` Peter Zijlstra
2007-01-18 13:58 ` Possible ways of dealing with OOM conditions Evgeniy Polyakov
2007-01-18 15:10 ` Peter Zijlstra
2007-01-18 15:50 ` Evgeniy Polyakov
2007-01-18 17:31 ` Peter Zijlstra
2007-01-18 18:34 ` Evgeniy Polyakov
2007-01-19 12:53 ` Peter Zijlstra
2007-01-19 22:56 ` Evgeniy Polyakov
2007-01-20 22:36 ` Rik van Riel
2007-01-21 1:46 ` Evgeniy Polyakov
2007-01-21 2:14 ` Evgeniy Polyakov
2007-01-21 16:30 ` Rik van Riel
2007-01-19 17:54 ` Christoph Lameter
2007-01-17 9:12 ` [PATCH 0/9] VM deadlock avoidance -v10 Pavel Machek
2007-01-17 9:20 ` 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=20070116101815.999600000@taijtu.programming.kicks-ass.net \
--to=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH 8/9] slab: kmem_cache_objs_to_pages()' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).