From: Mel Gorman <mel@csn.ul.ie>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Rik van Riel <riel@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nick Piggin <npiggin@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lin Ming <ming.m.lin@intel.com>,
Zhang Yanmin <yanmin_zhang@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 24/35] Convert gfp_zone() to use a table of precalculated values
Date: Mon, 16 Mar 2009 16:45:50 +0000 [thread overview]
Message-ID: <20090316164550.GL24293@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.1.10.0903161218170.32577@qirst.com>
On Mon, Mar 16, 2009 at 12:19:06PM -0400, Christoph Lameter wrote:
> On Mon, 16 Mar 2009, Mel Gorman wrote:
>
> > diff --git a/init/main.c b/init/main.c
> > index 8442094..08a5663 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -573,6 +573,7 @@ asmlinkage void __init start_kernel(void)
> > * fragile until we cpu_idle() for the first time.
> > */
> > preempt_disable();
> > + init_gfp_zone_table();
> > build_all_zonelists();
> > page_alloc_init();
> > printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index bc491fa..d76f57d 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -70,6 +70,7 @@ EXPORT_SYMBOL(node_states);
> > unsigned long totalram_pages __read_mostly;
> > unsigned long totalreserve_pages __read_mostly;
> > unsigned long highest_memmap_pfn __read_mostly;
> > +int gfp_zone_table[GFP_ZONEMASK] __read_mostly;
> > int static_num_online_nodes __read_mostly;
> > int percpu_pagelist_fraction;
> >
> > @@ -4569,7 +4570,7 @@ static void setup_per_zone_inactive_ratio(void)
> > * 8192MB: 11584k
> > * 16384MB: 16384k
> > */
> > -static int __init init_per_zone_pages_min(void)
> > +static int init_per_zone_pages_min(void)
> > {
> > unsigned long lowmem_kbytes;
> >
> > @@ -4587,6 +4588,39 @@ static int __init init_per_zone_pages_min(void)
> > }
> > module_init(init_per_zone_pages_min)
> >
> > +static inline int __init gfp_flags_to_zone(gfp_t flags)
> > +{
> > +#ifdef CONFIG_ZONE_DMA
> > + if (flags & __GFP_DMA)
> > + return ZONE_DMA;
> > +#endif
> > +#ifdef CONFIG_ZONE_DMA32
> > + if (flags & __GFP_DMA32)
> > + return ZONE_DMA32;
> > +#endif
> > + if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
> > + (__GFP_HIGHMEM | __GFP_MOVABLE))
> > + return ZONE_MOVABLE;
> > +#ifdef CONFIG_HIGHMEM
> > + if (flags & __GFP_HIGHMEM)
> > + return ZONE_HIGHMEM;
> > +#endif
> > + return ZONE_NORMAL;
> > +}
> > +
> > +/*
> > + * For each possible combination of zone modifier flags, we calculate
> > + * what zone it should be using. This consumes a cache line in most
> > + * cases but avoids a number of branches in the allocator fast path
> > + */
> > +void __init init_gfp_zone_table(void)
> > +{
> > + gfp_t gfp_flags;
> > +
> > + for (gfp_flags = 0; gfp_flags < GFP_ZONEMASK; gfp_flags++)
> > + gfp_zone_table[gfp_flags] = gfp_flags_to_zone(gfp_flags);
> > +}
> > +
>
> This is all known at compile time. The table can be calculated at compile
> time with some ifdefs and then we do not need the init_gfp_zone_table().
>
The last discussion didn't come up with something that could generate such
a table and still be correct in all cases. I guess someone could do it all
by hand but it was going to be an error prone exercise. I left the patch
as-is as a result.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mel@csn.ul.ie>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: Linux Memory Management List <linux-mm@kvack.org>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Rik van Riel <riel@redhat.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Nick Piggin <npiggin@suse.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lin Ming <ming.m.lin@intel.com>,
Zhang Yanmin <yanmin_zhang@linux.intel.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 24/35] Convert gfp_zone() to use a table of precalculated values
Date: Mon, 16 Mar 2009 16:45:50 +0000 [thread overview]
Message-ID: <20090316164550.GL24293@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.1.10.0903161218170.32577@qirst.com>
On Mon, Mar 16, 2009 at 12:19:06PM -0400, Christoph Lameter wrote:
> On Mon, 16 Mar 2009, Mel Gorman wrote:
>
> > diff --git a/init/main.c b/init/main.c
> > index 8442094..08a5663 100644
> > --- a/init/main.c
> > +++ b/init/main.c
> > @@ -573,6 +573,7 @@ asmlinkage void __init start_kernel(void)
> > * fragile until we cpu_idle() for the first time.
> > */
> > preempt_disable();
> > + init_gfp_zone_table();
> > build_all_zonelists();
> > page_alloc_init();
> > printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index bc491fa..d76f57d 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -70,6 +70,7 @@ EXPORT_SYMBOL(node_states);
> > unsigned long totalram_pages __read_mostly;
> > unsigned long totalreserve_pages __read_mostly;
> > unsigned long highest_memmap_pfn __read_mostly;
> > +int gfp_zone_table[GFP_ZONEMASK] __read_mostly;
> > int static_num_online_nodes __read_mostly;
> > int percpu_pagelist_fraction;
> >
> > @@ -4569,7 +4570,7 @@ static void setup_per_zone_inactive_ratio(void)
> > * 8192MB: 11584k
> > * 16384MB: 16384k
> > */
> > -static int __init init_per_zone_pages_min(void)
> > +static int init_per_zone_pages_min(void)
> > {
> > unsigned long lowmem_kbytes;
> >
> > @@ -4587,6 +4588,39 @@ static int __init init_per_zone_pages_min(void)
> > }
> > module_init(init_per_zone_pages_min)
> >
> > +static inline int __init gfp_flags_to_zone(gfp_t flags)
> > +{
> > +#ifdef CONFIG_ZONE_DMA
> > + if (flags & __GFP_DMA)
> > + return ZONE_DMA;
> > +#endif
> > +#ifdef CONFIG_ZONE_DMA32
> > + if (flags & __GFP_DMA32)
> > + return ZONE_DMA32;
> > +#endif
> > + if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
> > + (__GFP_HIGHMEM | __GFP_MOVABLE))
> > + return ZONE_MOVABLE;
> > +#ifdef CONFIG_HIGHMEM
> > + if (flags & __GFP_HIGHMEM)
> > + return ZONE_HIGHMEM;
> > +#endif
> > + return ZONE_NORMAL;
> > +}
> > +
> > +/*
> > + * For each possible combination of zone modifier flags, we calculate
> > + * what zone it should be using. This consumes a cache line in most
> > + * cases but avoids a number of branches in the allocator fast path
> > + */
> > +void __init init_gfp_zone_table(void)
> > +{
> > + gfp_t gfp_flags;
> > +
> > + for (gfp_flags = 0; gfp_flags < GFP_ZONEMASK; gfp_flags++)
> > + gfp_zone_table[gfp_flags] = gfp_flags_to_zone(gfp_flags);
> > +}
> > +
>
> This is all known at compile time. The table can be calculated at compile
> time with some ifdefs and then we do not need the init_gfp_zone_table().
>
The last discussion didn't come up with something that could generate such
a table and still be correct in all cases. I guess someone could do it all
by hand but it was going to be an error prone exercise. I left the patch
as-is as a result.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
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:[~2009-03-16 16:46 UTC|newest]
Thread overview: 188+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-16 9:45 [PATCH 00/35] Cleanup and optimise the page allocator V3 Mel Gorman
2009-03-16 9:45 ` Mel Gorman
2009-03-16 9:45 ` [PATCH 01/35] Replace __alloc_pages_internal() with __alloc_pages_nodemask() Mel Gorman
2009-03-16 9:45 ` Mel Gorman
2009-03-16 15:49 ` Christoph Lameter
2009-03-16 15:49 ` Christoph Lameter
2009-03-16 9:45 ` [PATCH 02/35] Do not sanity check order in the fast path Mel Gorman
2009-03-16 9:45 ` Mel Gorman
2009-03-16 15:52 ` Christoph Lameter
2009-03-16 15:52 ` Christoph Lameter
2009-03-16 9:45 ` [PATCH 03/35] Do not check NUMA node ID when the caller knows the node is valid Mel Gorman
2009-03-16 9:45 ` Mel Gorman
2009-03-16 9:45 ` [PATCH 04/35] Check only once if the zonelist is suitable for the allocation Mel Gorman
2009-03-16 9:45 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 05/35] Break up the allocator entry point into fast and slow paths Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 06/35] Move check for disabled anti-fragmentation out of fastpath Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 15:54 ` Christoph Lameter
2009-03-16 15:54 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 07/35] Check in advance if the zonelist needs additional filtering Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 08/35] Calculate the preferred zone for allocation only once Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 09/35] Calculate the migratetype " Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 10/35] Calculate the alloc_flags " Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 11/35] Calculate the cold parameter " Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 12/35] Remove a branch by assuming __GFP_HIGH == ALLOC_HIGH Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 13/35] Inline __rmqueue_smallest() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 14/35] Inline buffered_rmqueue() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 15/35] Inline __rmqueue_fallback() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 15:57 ` Christoph Lameter
2009-03-16 15:57 ` Christoph Lameter
2009-03-16 16:25 ` Mel Gorman
2009-03-16 16:25 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 16/35] Save text by reducing call sites of __rmqueue() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 17/35] Do not call get_pageblock_migratetype() more than necessary Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:00 ` Christoph Lameter
2009-03-16 16:00 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 18/35] Do not disable interrupts in free_page_mlock() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:05 ` Christoph Lameter
2009-03-16 16:05 ` Christoph Lameter
2009-03-16 16:29 ` Mel Gorman
2009-03-16 16:29 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 19/35] Do not setup zonelist cache when there is only one node Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:06 ` Christoph Lameter
2009-03-16 16:06 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 20/35] Use a pre-calculated value for num_online_nodes() Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 11:42 ` Nick Piggin
2009-03-16 11:42 ` Nick Piggin
2009-03-16 11:46 ` Nick Piggin
2009-03-16 11:46 ` Nick Piggin
2009-03-16 16:08 ` Christoph Lameter
2009-03-16 16:08 ` Christoph Lameter
2009-03-16 16:36 ` Mel Gorman
2009-03-16 16:36 ` Mel Gorman
2009-03-16 16:47 ` Christoph Lameter
2009-03-16 16:47 ` Christoph Lameter
2009-03-18 15:08 ` Mel Gorman
2009-03-18 15:08 ` Mel Gorman
2009-03-18 16:58 ` Christoph Lameter
2009-03-18 16:58 ` Christoph Lameter
2009-03-18 18:01 ` Mel Gorman
2009-03-18 18:01 ` Mel Gorman
2009-03-18 19:10 ` Christoph Lameter
2009-03-18 19:10 ` Christoph Lameter
2009-03-19 20:43 ` Christoph Lameter
2009-03-19 20:43 ` Christoph Lameter
2009-03-19 21:29 ` Mel Gorman
2009-03-19 21:29 ` Mel Gorman
2009-03-19 22:22 ` Christoph Lameter
2009-03-19 22:22 ` Christoph Lameter
2009-03-19 22:33 ` Mel Gorman
2009-03-19 22:33 ` Mel Gorman
2009-03-19 22:42 ` Christoph Lameter
2009-03-19 22:42 ` Christoph Lameter
2009-03-19 22:52 ` Mel Gorman
2009-03-19 22:52 ` Mel Gorman
2009-03-19 22:06 ` Mel Gorman
2009-03-19 22:06 ` Mel Gorman
2009-03-19 22:39 ` Christoph Lameter
2009-03-19 22:39 ` Christoph Lameter
2009-03-19 22:21 ` Mel Gorman
2009-03-19 22:21 ` Mel Gorman
2009-03-19 22:24 ` Christoph Lameter
2009-03-19 22:24 ` Christoph Lameter
2009-03-19 23:04 ` Mel Gorman
2009-03-19 23:04 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 21/35] Do not check for compound pages during the page allocator sanity checks Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:09 ` Christoph Lameter
2009-03-16 16:09 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 22/35] Use allocation flags as an index to the zone watermark Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:11 ` Christoph Lameter
2009-03-16 16:11 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 23/35] Update NR_FREE_PAGES only as necessary Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:17 ` Christoph Lameter
2009-03-16 16:17 ` Christoph Lameter
2009-03-16 16:42 ` Mel Gorman
2009-03-16 16:42 ` Mel Gorman
2009-03-16 16:48 ` Christoph Lameter
2009-03-16 16:48 ` Christoph Lameter
2009-03-16 16:58 ` Mel Gorman
2009-03-16 16:58 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 24/35] Convert gfp_zone() to use a table of precalculated values Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:19 ` Christoph Lameter
2009-03-16 16:19 ` Christoph Lameter
2009-03-16 16:45 ` Mel Gorman [this message]
2009-03-16 16:45 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 25/35] Re-sort GFP flags and fix whitespace alignment for easier reading Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 26/35] Use the per-cpu allocator for orders up to PAGE_ALLOC_COSTLY_ORDER Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:26 ` Christoph Lameter
2009-03-16 16:26 ` Christoph Lameter
2009-03-16 16:47 ` Mel Gorman
2009-03-16 16:47 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 27/35] Split per-cpu list into one-list-per-migrate-type Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 28/35] Batch free pages from migratetype per-cpu lists Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 29/35] Do not store the PCP high and batch watermarks in the per-cpu structure Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:30 ` Christoph Lameter
2009-03-16 16:30 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 30/35] Skip the PCP list search by counting the order and type of pages on list Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:31 ` Christoph Lameter
2009-03-16 16:31 ` Christoph Lameter
2009-03-16 16:51 ` Mel Gorman
2009-03-16 16:51 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 31/35] Optimistically check the first page on the PCP free list is suitable Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:33 ` Christoph Lameter
2009-03-16 16:33 ` Christoph Lameter
2009-03-16 16:52 ` Mel Gorman
2009-03-16 16:52 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 32/35] Inline next_zones_zonelist() of the zonelist scan in the fastpath Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 33/35] Do not merge buddies until they are needed by a high-order allocation or anti-fragmentation Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 9:46 ` [PATCH 34/35] Allow compound pages to be stored on the PCP lists Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 16:47 ` Christoph Lameter
2009-03-16 16:47 ` Christoph Lameter
2009-03-16 9:46 ` [PATCH 35/35] Allow up to 4MB PCP lists due to compound pages Mel Gorman
2009-03-16 9:46 ` Mel Gorman
2009-03-16 10:40 ` [PATCH 00/35] Cleanup and optimise the page allocator V3 Nick Piggin
2009-03-16 10:40 ` Nick Piggin
2009-03-16 11:19 ` Mel Gorman
2009-03-16 11:19 ` Mel Gorman
2009-03-16 11:33 ` Nick Piggin
2009-03-16 11:33 ` Nick Piggin
2009-03-16 12:02 ` Mel Gorman
2009-03-16 12:02 ` Mel Gorman
2009-03-16 12:25 ` Nick Piggin
2009-03-16 12:25 ` Nick Piggin
2009-03-16 13:32 ` Mel Gorman
2009-03-16 13:32 ` Mel Gorman
2009-03-16 15:53 ` Nick Piggin
2009-03-16 15:53 ` Nick Piggin
2009-03-16 16:56 ` Mel Gorman
2009-03-16 16:56 ` Mel Gorman
2009-03-16 17:05 ` Nick Piggin
2009-03-16 17:05 ` Nick Piggin
2009-03-18 15:07 ` Mel Gorman
2009-03-18 15:07 ` Mel Gorman
2009-03-16 11:45 ` Nick Piggin
2009-03-16 11:45 ` Nick Piggin
2009-03-16 12:11 ` Mel Gorman
2009-03-16 12:11 ` Mel Gorman
2009-03-16 12:28 ` Nick Piggin
2009-03-16 12:28 ` Nick Piggin
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=20090316164550.GL24293@csn.ul.ie \
--to=mel@csn.ul.ie \
--cc=cl@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ming.m.lin@intel.com \
--cc=npiggin@suse.de \
--cc=penberg@cs.helsinki.fi \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=yanmin_zhang@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.