From: mel@skynet.ie (Mel Gorman)
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Nick Piggin <nickpiggin@yahoo.com.au>, Andi Kleen <ak@suse.de>,
Paul Jackson <pj@sgi.com>, Dave Chinner <dgc@sgi.com>
Subject: Re: [RFC 2/8] Basic allocation for higher order page cache pages
Date: Fri, 20 Apr 2007 11:55:52 +0100 [thread overview]
Message-ID: <20070420105552.GA12075@skynet.ie> (raw)
In-Reply-To: <20070419163515.11948.44138.sendpatchset@schroedinger.engr.sgi.com>
On (19/04/07 09:35), Christoph Lameter didst pronounce:
> Variable Order Page Cache: Add basic allocation functions
>
> Extend __page_cache_alloc to take an order parameter and
> modify caller sites. Modify mapping_set_gfp_mask to set
> __GFP_COMP if the mapping requires higher order allocations.
>
> put_page() is already capable of handling compound pages. So
> there are no changes needed to release higher order page
> cache pages.
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> include/linux/pagemap.h | 15 +++++++++------
> mm/filemap.c | 9 +++++----
> 2 files changed, 14 insertions(+), 10 deletions(-)
>
> Index: linux-2.6.21-rc7/include/linux/pagemap.h
> ===================================================================
> --- linux-2.6.21-rc7.orig/include/linux/pagemap.h 2007-04-18 21:21:56.000000000 -0700
> +++ linux-2.6.21-rc7/include/linux/pagemap.h 2007-04-18 21:29:02.000000000 -0700
> @@ -32,6 +32,8 @@ static inline void mapping_set_gfp_mask(
> {
> m->flags = (m->flags & ~(__force unsigned long)__GFP_BITS_MASK) |
> (__force unsigned long)mask;
> + if (m->order)
> + m->flags |= __GFP_COMP;
This might need a comment. It might not be superclear that compound
pages have destructors that know how to lookup the order on free.
> }
>
> /*
> @@ -40,7 +42,7 @@ static inline void mapping_set_gfp_mask(
> * throughput (it can then be mapped into user
> * space in smaller chunks for same flexibility).
> *
> - * Or rather, it _will_ be done in larger chunks.
> + * This is the base page size
> */
> #define PAGE_CACHE_SHIFT PAGE_SHIFT
> #define PAGE_CACHE_SIZE PAGE_SIZE
> @@ -52,22 +54,23 @@ static inline void mapping_set_gfp_mask(
> void release_pages(struct page **pages, int nr, int cold);
>
> #ifdef CONFIG_NUMA
> -extern struct page *__page_cache_alloc(gfp_t gfp);
> +extern struct page *__page_cache_alloc(gfp_t gfp, int order);
> #else
> -static inline struct page *__page_cache_alloc(gfp_t gfp)
> +static inline struct page *__page_cache_alloc(gfp_t gfp, int order)
> {
> - return alloc_pages(gfp, 0);
> + return alloc_pages(gfp, order);
> }
> #endif
>
> static inline struct page *page_cache_alloc(struct address_space *x)
> {
> - return __page_cache_alloc(mapping_gfp_mask(x));
> + return __page_cache_alloc(mapping_gfp_mask(x), x->order);
> }
>
> static inline struct page *page_cache_alloc_cold(struct address_space *x)
> {
> - return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD);
> + return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD,
> + x->order);
> }
>
> typedef int filler_t(void *, struct page *);
> Index: linux-2.6.21-rc7/mm/filemap.c
> ===================================================================
> --- linux-2.6.21-rc7.orig/mm/filemap.c 2007-04-18 21:21:56.000000000 -0700
> +++ linux-2.6.21-rc7/mm/filemap.c 2007-04-18 21:28:30.000000000 -0700
> @@ -467,13 +467,13 @@ int add_to_page_cache_lru(struct page *p
> }
>
> #ifdef CONFIG_NUMA
> -struct page *__page_cache_alloc(gfp_t gfp)
> +struct page *__page_cache_alloc(gfp_t gfp, int order)
> {
> if (cpuset_do_page_mem_spread()) {
> int n = cpuset_mem_spread_node();
> - return alloc_pages_node(n, gfp, 0);
> + return alloc_pages_node(n, gfp, order);
> }
> - return alloc_pages(gfp, 0);
> + return alloc_pages(gfp, order);
> }
> EXPORT_SYMBOL(__page_cache_alloc);
> #endif
> @@ -803,7 +803,8 @@ grab_cache_page_nowait(struct address_sp
> page_cache_release(page);
> return NULL;
> }
> - page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS);
> + page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS,
> + mapping->order);
> if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) {
> page_cache_release(page);
> page = NULL;
> -
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
next prev parent reply other threads:[~2007-04-20 10:55 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-19 16:35 [RFC 0/8] Variable Order Page Cache Christoph Lameter
2007-04-19 16:35 ` [RFC 1/8] Add order field to address_space struct Christoph Lameter
2007-04-19 16:35 ` [RFC 2/8] Basic allocation for higher order page cache pages Christoph Lameter
2007-04-20 10:55 ` Mel Gorman [this message]
2007-04-19 16:35 ` [RFC 3/8] Flushing and zeroing " Christoph Lameter
2007-04-20 11:02 ` Mel Gorman
2007-04-20 16:15 ` Christoph Lameter
2007-04-20 16:51 ` William Lee Irwin III
2007-04-19 16:35 ` [RFC 4/8] Enhance fallback functions in libs to support higher order pages Christoph Lameter
2007-04-19 18:48 ` Adam Litke
2007-04-19 19:10 ` Christoph Lameter
2007-04-19 22:50 ` David Chinner
2007-04-20 1:15 ` Christoph Lameter
2007-04-20 8:21 ` Jens Axboe
2007-04-20 16:01 ` Christoph Lameter
2007-04-20 16:51 ` Jens Axboe
2007-04-20 11:05 ` Mel Gorman
2007-04-20 18:50 ` Dave Kleikamp
2007-04-20 19:10 ` Christoph Lameter
2007-04-20 19:27 ` Dave Kleikamp
2007-04-24 23:00 ` Matt Mackall
2007-04-19 16:35 ` [RFC 5/8] Enhance generic_read/write " Christoph Lameter
2007-04-19 16:35 ` [RFC 6/8] Account for pages in the page cache in terms of base pages Christoph Lameter
2007-04-19 17:45 ` Nish Aravamudan
2007-04-19 17:52 ` Christoph Lameter
2007-04-19 17:54 ` Avi Kivity
2007-04-19 16:35 ` [RFC 7/8] Enhance ramfs to support higher order pages Christoph Lameter
2007-04-20 13:42 ` Mel Gorman
2007-04-20 14:47 ` William Lee Irwin III
2007-04-20 16:30 ` Christoph Lameter
2007-04-20 17:11 ` William Lee Irwin III
2007-04-20 17:15 ` Christoph Lameter
2007-04-20 17:19 ` William Lee Irwin III
2007-04-20 17:57 ` Christoph Lameter
2007-04-20 19:21 ` William Lee Irwin III
2007-04-20 17:59 ` Christoph Lameter
2007-04-20 18:01 ` Christoph Lameter
2007-04-20 18:02 ` Christoph Lameter
2007-04-20 16:20 ` Christoph Lameter
2007-04-19 16:35 ` [RFC 8/8] Add some debug output Christoph Lameter
2007-04-19 19:09 ` [RFC 0/8] Variable Order Page Cache Badari Pulavarty
2007-04-19 19:12 ` Christoph Lameter
2007-04-19 19:11 ` Andi Kleen
2007-04-19 19:15 ` Christoph Lameter
2007-04-20 14:37 ` Mel Gorman
2007-04-19 22:42 ` David Chinner
2007-04-20 1:14 ` Christoph Lameter
2007-04-20 6:32 ` Jens Axboe
2007-04-20 7:48 ` David Chinner
2007-04-21 22:18 ` Andrew Morton
2007-04-19 23:58 ` Maxim Levitsky
2007-04-20 1:15 ` Christoph Lameter
2007-04-20 4:47 ` William Lee Irwin III
2007-04-20 5:27 ` Christoph Lameter
2007-04-20 6:22 ` William Lee Irwin III
2007-04-20 8:42 ` David Chinner
2007-04-20 14:14 ` Mel Gorman
2007-04-20 16:23 ` Christoph Lameter
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=20070420105552.GA12075@skynet.ie \
--to=mel@skynet.ie \
--cc=a.p.zijlstra@chello.nl \
--cc=ak@suse.de \
--cc=clameter@sgi.com \
--cc=dgc@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nickpiggin@yahoo.com.au \
--cc=pj@sgi.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