Apply memory policies to top two highest zones when highest zone is ZONE_MOVABLE
Subsystems (11)
PATCH 1/1 Apply memory policies to top two highest zones when highest zone is ZONE_MOVABLE
The NUMA layer only supports NUMA policies for the highest zone. When ZONE_MOVABLE is configured with kernelcore=, the the highest zone becomes ZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated from ZONE_MOVABLE when the zone is used.
This patch applies policies to the two highest zones when the highest zone is ZONE_MOVABLE. As ZONE_MOVABLE consists of pages from the highest "real" zone, it's always functionally equivalent.
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86, x86_64 and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.
--- include/linux/mempolicy.h | 2 +- include/linux/mmzone.h | 18 ++++++++++++++++++ mm/mempolicy.c | 2 +- mm/page_alloc.c | 13 +++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-)
include/linux/mempolicy.h +1 -1
@@ -166,7 +166,7 @@ extern enum zone_type policy_zone;static inline void check_highest_zone (enum zone_type k) { -if (k > policy_zone) +if (k > policy_zone && k !=ZONE_MOVABLE ) policy_zone = k; }
include/linux/mmzone.h +18 -0
@@ -410,6 +410,24 @@ struct zonelist {#endif }; +#ifdef CONFIG_NUMA +/* +* Only custom zonelists like MPOL_BIND need to be filtered as part of +* policies. As described in the comment for struct zonelist_cache, these +* zonelists will not have a zlcache so zlcache_ptr will not be set. Use +* that to determine if the zonelists needs to be filtered or not. +*/ +static inline int alloc_should_filter_zonelist (struct zonelist *zonelist) +{ +return !zonelist->zlcache_ptr; +} +#else +static inline int alloc_should_filter_zonelist (struct zonelist *zonelist) +{ +return 0 ; +} +#endif /* CONFIG_NUMA */ + #ifdef CONFIG_ARCH_POPULATES_NODE_MAP struct node_active_region { unsigned long start_pfn;
mm/mempolicy.c +1 -1
@@ -149,7 +149,7 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)lower zones etc. Avoid empty zones because the memory allocator doesn't like them. If you implement node hot removal you have to fix that. */ - k = policy_zone; + k =MAX_NR_ZONES -1 ;while (1 ) {for_each_node_mask (nd, *nodes) {struct zone *z = &NODE_DATA (nd)->node_zones[k];
mm/page_alloc.c +13 -0
@@ -1157,6 +1157,7 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order,nodemask_t *allowednodes =NULL ;/* zonelist_cache approximation */ int zlc_active =0 ;/* set if using zonelist_cache */ int did_zlc_setup =0 ;/* just call zlc_setup() one time */ +enum zone_type highest_zoneidx =-1 ;/* Gets set for policy zonelists */ zonelist_scan:/*
@@ -1166,6 +1167,18 @@ zonelist_scan: z = zonelist->zones; do { + /* + * In NUMA, this could be a policy zonelist which contains + * zones that may not be allowed by the current gfp_mask. + * Check the zone is allowed by the current flags + */ + if (unlikely(alloc_should_filter_zonelist(zonelist))) { + if (highest_zoneidx == -1) + highest_zoneidx = gfp_zone(gfp_mask); + if (zone_idx(*z) > highest_zoneidx) + continue; + } + if (NUMA_BUILD && zlc_active && !zlc_zone_worth_trying(zonelist, z, allowednodes)) continue;
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 10 lines · Mel Gorman
The NUMA layer only supports NUMA policies for the highest zone. When
ZONE_MOVABLEis configured with kernelcore=, the the highest zone becomesZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated fromZONE_MOVABLEwhen the zone is used.This patch applies policies to the two highest zones when the highest zone is
ZONE_MOVABLE. AsZONE_MOVABLEconsists of pages from the highest "real" zone, it's always functionally equivalent.
Quoted 7 lines
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86,
x86_64and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.Signed-off-by Mel Gorman <[email protected]>
And an ia_64 NUMA platform with some ad hoc, interactive functional testing with memtoy and an overnight run of a usex job mix. Job mix included a 32-way kernel build, several povray tracing apps, IO tests, sequential and random vm fault tests and a number of 'bin' tests that simulate a half a dozen crazed monkeys pounding away at keyboards entering surprisingly error-free commands. All of these loop until stopped or the system hangs/crashes--which it didn't...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
include/linux/mmzone.h struct zonelist { · line 423
Quoted 11 lines · Mel Gorman
include/linux/mmzone.h +11
-0+#ifdef CONFIG_NUMA +/* +* Only custom zonelists like MPOL_BIND need to be filtered as part of +* policies. As described in the comment for struct zonelist_cache, these +* zonelists will not have a zlcache so zlcache_ptr will not be set. Use +* that to determine if the zonelists needs to be filtered or not. +*/ +static inline int alloc_should_filter_zonelist (struct zonelist *zonelist) +{ +return !zonelist->zlcache_ptr; +}
I guess Paul needs to have a look at this one.
Otherwise
Quoted 7 lines
mm/page_alloc.c +3
-0@@ -1166,6 +1167,18 @@ zonelist_scan: z = zonelist->zones; do { + /* + * In NUMA, this could be a policy zonelist which contains + * zones that may not be allowed by the current gfp_mask.
mm/page_alloc.c zonelist_scan: · line 1182
Quoted 10 lines
mm/page_alloc.c +9
-0+* Check the zone is allowed by the current flags +*/ +if (unlikely (alloc_should_filter_zonelist (zonelist))) { +if (highest_zoneidx ==-1 ) + highest_zoneidx =gfp_zone (gfp_mask); +if (zone_idx (*z) > highest_zoneidx) +continue ; + } + if (NUMA_BUILD && zlc_active &&
Hotpath. Sigh.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 15 lines · On Thu, 2 Aug 2007 13:45:23 -0700 (PDT) Christoph Lameter <[email protected]>…
include/linux/mmzone.h struct zonelist { · line 423
Quoted 11 lines · Mel Gorman
include/linux/mmzone.h +11
-0+#ifdef CONFIG_NUMA +/* +* Only custom zonelists like MPOL_BIND need to be filtered as part of +* policies. As described in the comment for struct zonelist_cache, these +* zonelists will not have a zlcache so zlcache_ptr will not be set. Use +* that to determine if the zonelists needs to be filtered or not. +*/ +static inline int alloc_should_filter_zonelist (struct zonelist *zonelist) +{ +return !zonelist->zlcache_ptr; +}I guess Paul needs to have a look at this one.
Which Paul?
Quoted 7 lines
Otherwise
Quoted 3 lines
mm/page_alloc.c +0
-0@@ -1166,6 +1167,18 @@ zonelist_scan: z = zonelist->zones;
Quoted 16 lines
Quoted 4 lines
mm/page_alloc.c +3
-0do { + /* + * In NUMA, this could be a policy zonelist which contains + * zones that may not be allowed by the current gfp_mask.mm/page_alloc.c zonelist_scan: · line 1182
Quoted 10 lines
mm/page_alloc.c +9
-0+* Check the zone is allowed by the current flags +*/ +if (unlikely (alloc_should_filter_zonelist (zonelist))) { +if (highest_zoneidx ==-1 ) + highest_zoneidx =gfp_zone (gfp_mask); +if (zone_idx (*z) > highest_zoneidx) +continue ; + } + if (NUMA_BUILD && zlc_active &&Hotpath. Sigh.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Andrew Morton
Which Paul?
Paul Jackson.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Christoph wrote, responding to Mel and Andrew:
Quoted 6 lines
include/linux/mmzone.h struct zonelist { · line 423
Quoted 4 lines
include/linux/mmzone.h +4
-0+static inline int alloc_should_filter_zonelist (struct zonelist *zonelist) +{ +return !zonelist->zlcache_ptr; +}I guess Paul needs to have a look at this one.
...
Quoted 3 lines
Quoted 1 line
Which Paul?
Paul Jackson.
I'll ack that the above snippet of code, alloc_should_filter_zonelist(), does, as its comment explains, return true iff it's a custom zonelist such as from MPOL_BIND.
As to the more interesting issues that this patch raises ... I have no clue.
Signature · 9 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.925.600.0401
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>Quoted 10 lines · On Thursday 02 August 2007 19:21:18 Mel Gorman wrote:
The NUMA layer only supports NUMA policies for the highest zone. When
ZONE_MOVABLEis configured with kernelcore=, the the highest zone becomesZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated fromZONE_MOVABLEwhen the zone is used.This patch applies policies to the two highest zones when the highest zone is
ZONE_MOVABLE. AsZONE_MOVABLEconsists of pages from the highest "real" zone, it's always functionally equivalent.
Quoted 5 lines
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86,
x86_64and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.
I must honestly say I really hate the patch. It's a horrible hack and makes fast paths slower. When I designed mempolicies I especially tried to avoid things like that, please don't add them through the backdoor now.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (04/08/07 00:02), Andi Kleen didst pronounce:
Quoted 17 lines · On Thursday 02 August 2007 19:21:18 Mel Gorman wrote:
Quoted 10 lines
The NUMA layer only supports NUMA policies for the highest zone. When
ZONE_MOVABLEis configured with kernelcore=, the the highest zone becomesZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated fromZONE_MOVABLEwhen the zone is used.This patch applies policies to the two highest zones when the highest zone is
ZONE_MOVABLE. AsZONE_MOVABLEconsists of pages from the highest "real" zone, it's always functionally equivalent.Quoted 5 lines
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86,
x86_64and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.
Quoted 4 lines
I must honestly say I really hate the patch. It's a horrible hack and makes fast paths slower. When I designed mempolicies I especially tried to avoid things like that, please don't add them through the backdoor now.
It only affects hot paths in the NUMA case so non-NUMA users will not care. For NUMA users, I have posted patches that eliminate multiple zonelists altogether which will reduce cache footprint (something like 7K per node on x86_64) and make things like MPOL_BIND behave in a consistent manner. That would cost on CPU but save on cache which would (hopefully) result in a net gain in most cases.
I would like to go with this patch for now just for policies but for 2.6.23, we could leave it as "policies only apply to ZONE_MOVABLE when it is used" if you really insisted on it. It's less than ideal though for sure.
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line
It only affects hot paths in the NUMA case so non-NUMA users will not care.
For x86-64 most distribution kernels are NUMA these days.
Quoted 3 lines
For NUMA users, I have posted patches that eliminate multiple zonelists altogether which will reduce cache footprint (something like 7K per node on
x86_64)
How do you get to 7k? We got worst case 3 zones node (normally less); that's three pointers per GFP level.
Quoted 3 lines
and make things like
MPOL_BINDbehave in a consistent manner. That would cost on CPU but save on cache which would (hopefully) result in a net gain in most cases.
That might be a good tradeoff, but without seeing the patch the 7k number sounds very dubious.
Quoted 4 lines
I would like to go with this patch for now just for policies but for 2.6.23, we could leave it as "policies only apply to
ZONE_MOVABLEwhen it is used" if you really insisted on it. It's less than ideal though for sure.
Or disable ZONE_MOVABLE. It seems to be clearly not well thought out well yet. Perhaps make it dependent on !CONFIG_NUMA.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (04/08/07 10:51), Andi Kleen didst pronounce:
Quoted 12 lines
Quoted 2 lines
It only affects hot paths in the NUMA case so non-NUMA users will not care.
For x86-64 most distribution kernels are NUMA these days.
Quoted 3 lines
For NUMA users, I have posted patches that eliminate multiple zonelists altogether which will reduce cache footprint (something like 7K per node on
x86_64)How do you get to 7k? We got worst case 3 zones node (normally less); that's three pointers per GFP level.
The zonelists are pretty big. On a 4 node x86_64 machine (elm3b6 from tko), the size of pg_data_t goes from 13632 bytes to 5824 (almost 8k in fact) when only one zonelists is used.
Quoted 7 lines
Quoted 3 lines
and make things like
MPOL_BINDbehave in a consistent manner. That would cost on CPU but save on cache which would (hopefully) result in a net gain in most cases.That might be a good tradeoff, but without seeing the patch the 7k number sounds very dubious.
Proof-of-concept patch is below. It's not suitable for merging and I was getting the policy issue resolved first before spending more time on it. The patch was a big too heavy to call a fix for a bug.
Quoted 7 lines
Quoted 4 lines
I would like to go with this patch for now just for policies but for 2.6.23, we could leave it as "policies only apply to
ZONE_MOVABLEwhen it is used" if you really insisted on it. It's less than ideal though for sure.Or disable
ZONE_MOVABLE. It seems to be clearly not well thought out well yet.
The zone is disabled by default. When enabled, the policies are only applied to it which is expected, but not desirable which is why I wanted to apply policies to the two highest zones when the highest was ZONE_MOVABLE.
Quoted 2 lines
Perhaps make it dependent on !CONFIG_NUMA.
That would make no sense. The systems that will be using hugepages and looking to resize their pool will often be NUMA machines and you state that most x86_64 distros will have NUMA enabled.
This is the prototype patch for removing multiple zonelists altogether. It would also act as a fix for the policies-only-applying-to-ZONE_MOVABLE problem. You may not that where the filtering takes place in __alloc_pages() is in the same place as with the patch to fix policies so there is a logical progression from bug fix now to something with wider usefulness later.
arch/parisc/mm/init.c +5 -2
@@ -602,12 +602,15 @@ void show_mem(void)int i, j, k;for (i =0 ; i < npmem_ranges; i++) { + zl = &NODE_DATA (i)->node_zonelist;for (j =0 ; j <MAX_NR_ZONES ; j++) { - zl =NODE_DATA (i)->node_zonelists + j;printk ("Zone list for zone %d on node %d: " , j, i); -for (k =0 ; zl->zones[k] !=NULL ; k++) +for (k =0 ; zl->zones[k] !=NULL ; k++) { +if (should_filter_zone (zl->zones[k]), j) +continue ;printk ("[%ld/%s] " ,zone_to_nid (zl->zones[k]), zl->zones[k]->name); + }printk ("\n" ); } }
drivers/char/sysrq.c +1 -1
@@ -270,7 +270,7 @@ static struct sysrq_key_op sysrq_term_op = {static void moom_callback (struct work_struct *ignored) { -out_of_memory (&NODE_DATA (0 )->node_zonelists[ZONE_NORMAL ], +out_of_memory (&NODE_DATA (0 )->node_zonelist,GFP_KERNEL ,0 ); }
fs/buffer.c +1 -1
@@ -354,7 +354,7 @@ static void free_more_memory(void)yield ();for_each_online_pgdat (pgdat) { - zones = pgdat->node_zonelists[gfp_zone (GFP_NOFS )].zones; + zones = pgdat->node_zonelist.zones;if (*zones)try_to_free_pages (zones,0 ,GFP_NOFS ); }
include/linux/gfp.h +8 -2
@@ -116,6 +116,13 @@ static inline enum zone_type gfp_zone(gfp_t flags)return ZONE_NORMAL ; } +static inline int should_filter_zone (struct zone *zone,int highest_zoneidx) +{ +if (zone_idx (zone) > highest_zoneidx) +return 1 ; +return 0 ; +} +/* * There is only one page-allocator function, and two main namespaces to * it. The alloc_page*() variants return 'struct page *' and as such
@@ -151,8 +158,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,if (nid <0 ) nid =numa_node_id (); -return __alloc_pages (gfp_mask, order, -NODE_DATA (nid)->node_zonelists +gfp_zone (gfp_mask)); +return __alloc_pages (gfp_mask, order, &NODE_DATA (nid)->node_zonelist); }#ifdef CONFIG_NUMA
include/linux/mempolicy.h +2 -2
@@ -166,7 +166,7 @@ extern enum zone_type policy_zone;static inline void check_highest_zone (enum zone_type k) { -if (k > policy_zone) +if (k > policy_zone && k !=ZONE_MOVABLE ) policy_zone = k; }
@@ -258,7 +258,7 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)static inline struct zonelist *huge_zonelist (struct vm_area_struct *vma,unsigned long addr,gfp_t gfp_flags) { -return NODE_DATA (0 )->node_zonelists +gfp_zone (gfp_flags); +return &NODE_DATA (0 )->node_zonelist; } static inline int do_migrate_pages(struct mm_struct *mm,
include/linux/mmzone.h +4 -3
@@ -201,6 +201,7 @@ struct zone {*/ unsigned long lowmem_reserve[MAX_NR_ZONES ]; +int zone_idx;#ifdef CONFIG_NUMA int node;/*
@@ -437,7 +438,7 @@ extern struct page *mem_map;struct bootmem_data ; typedef struct pglist_data { struct zone node_zones[MAX_NR_ZONES]; - struct zonelist node_zonelists[MAX_NR_ZONES]; + struct zonelist node_zonelist; int nr_zones; #ifdef CONFIG_FLAT_NODE_MEM_MAP struct page *node_mem_map;
@@ -501,7 +502,7 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);/* * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc. */ -#define zone_idx (zone) ((zone) - (zone)->zone_pgdat->node_zones) +#define zone_idx (zone) ((zone)->zone_idx)static inline int populated_zone (struct zone *zone) {
@@ -543,7 +544,7 @@ static inline int is_normal_idx(enum zone_type idx)static inline int is_highmem (struct zone *zone) {#ifdef CONFIG_HIGHMEM -int zone_idx = zone - zone->zone_pgdat->node_zones; +int zone_idx =zone_idx (zone);return zone_idx ==ZONE_HIGHMEM || (zone_idx ==ZONE_MOVABLE &&zone_movable_is_highmem ());#else
mm/mempolicy.c +4 -4
@@ -149,7 +149,7 @@ static struct zonelist *bind_zonelist(nodemask_t *nodes)lower zones etc. Avoid empty zones because the memory allocator doesn't like them. If you implement node hot removal you have to fix that. */ - k = policy_zone; + k =MAX_NR_ZONES -1 ;while (1 ) {for_each_node_mask (nd, *nodes) {struct zone *z = &NODE_DATA (nd)->node_zones[k];
@@ -1116,7 +1116,7 @@ static struct zonelist *zonelist_policy(gfp_t gfp, struct mempolicy *policy) nd =0 ;BUG (); } -return NODE_DATA (nd)->node_zonelists +gfp_zone (gfp); +return &NODE_DATA (nd)->node_zonelist; }/* Do dynamic interleaving for a process */
@@ -1212,7 +1212,7 @@ struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr,unsigned nid; nid =interleave_nid (pol, vma, addr,HPAGE_SHIFT ); -return NODE_DATA (nid)->node_zonelists +gfp_zone (gfp_flags); +return &NODE_DATA (nid)->node_zonelist; }return zonelist_policy (GFP_HIGHUSER , pol); }
@@ -1226,7 +1226,7 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,struct zonelist *zl;struct page *page; - zl =NODE_DATA (nid)->node_zonelists +gfp_zone (gfp); + zl = &NODE_DATA (nid)->node_zonelist; page =__alloc_pages (gfp, order, zl);if (page &&page_zone (page) == zl->zones[0 ])inc_zone_page_state (page,NUMA_INTERLEAVE_HIT );
mm/oom_kill.c +6 -1
@@ -179,6 +179,7 @@ static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)struct zone **z;nodemask_t nodes;int node; +enum zone_type highest_zoneidx =gfp_zone (gfp_mask);nodes_clear (nodes);/* node has memory ? */
@@ -186,11 +187,15 @@ static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask)if (NODE_DATA (node)->node_present_pages)node_set (node, nodes); -for (z = zonelist->zones; *z; z++) +for (z = zonelist->zones; *z; z++) { + +if (should_filter_zone (*z, highest_zoneidx)) +continue ;if (cpuset_zone_allowed_softwall (*z, gfp_mask))node_clear (zone_to_nid (*z), nodes);else return CONSTRAINT_CPUSET ; + }if (!nodes_empty (nodes))return CONSTRAINT_MEMORY_POLICY ;
mm/page_alloc.c +54 -58
194 lines not on this page · raw message
mm/slab.c +5 -2
@@ -3216,12 +3216,12 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)struct zone **z;void *obj =NULL ;int nid; +enum zone_type highest_zoneidx =gfp_zone (flags);if (flags & __GFP_THISNODE)return NULL ; - zonelist = &NODE_DATA (slab_node (current->mempolicy)) - ->node_zonelists[gfp_zone (flags)]; + zonelist = &NODE_DATA (slab_node (current->mempolicy))->node_zonelist; local_flags = (flags &GFP_LEVEL_MASK ); retry:
@@ -3230,6 +3230,9 @@ retry:* from existing per node queues. */ for (z = zonelist->zones; *z && !obj; z++) { +if (should_filter_zone (*z, highest_zoneidx)) +continue ; + nid =zone_to_nid (*z); if (cpuset_zone_allowed_hardwall(*z, flags) &&
mm/slub.c +5 -2
@@ -1276,6 +1276,7 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)struct zonelist *zonelist;struct zone **z;struct page *page; +enum zone_type highest_zoneidx =gfp_zone (flags);/* * The defrag ratio allows a configuration of the tradeoffs between
@@ -1298,11 +1299,13 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)if (!s->defrag_ratio ||get_cycles () %1024 > s->defrag_ratio)return NULL ; - zonelist = &NODE_DATA (slab_node (current->mempolicy)) - ->node_zonelists[gfp_zone (flags)]; + zonelist = &NODE_DATA (slab_node (current->mempolicy))->node_zonelist;for (z = zonelist->zones; *z; z++) {struct kmem_cache_node *n; +if (should_filter_zone (*z, highest_zoneidx)) +continue ; + n =get_node (s,zone_to_nid (*z)); if (n && cpuset_zone_allowed_hardwall(*z, flags) &&
mm/vmscan.c +6 -0
@@ -1124,6 +1124,7 @@ unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)unsigned long nr_reclaimed =0 ;struct reclaim_state *reclaim_state = current->reclaim_state;unsigned long lru_pages =0 ; +enum zone_type highest_zoneidx;int i;struct scan_control sc = { .gfp_mask = gfp_mask,
@@ -1136,9 +1137,14 @@ unsigned long try_to_free_pages(struct zone **zones, int order, gfp_t gfp_mask)count_vm_event (ALLOCSTALL ); + highest_zoneidx =gfp_zone (gfp_mask); +for (i =0 ; zones[i] !=NULL ; i++) {struct zone *zone = zones[i]; +if (should_filter_zone (zone, highest_zoneidx)) +continue ; +if (!cpuset_zone_allowed_hardwall (zone,GFP_KERNEL ))continue ;
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 17 lines · On Sat, 4 Aug 2007 00:02:17 +0200 Andi Kleen <[email protected]> wrote:
Quoted 10 lines · On Thursday 02 August 2007 19:21:18 Mel Gorman wrote:
The NUMA layer only supports NUMA policies for the highest zone. When
ZONE_MOVABLEis configured with kernelcore=, the the highest zone becomesZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated fromZONE_MOVABLEwhen the zone is used.This patch applies policies to the two highest zones when the highest zone is
ZONE_MOVABLE. AsZONE_MOVABLEconsists of pages from the highest "real" zone, it's always functionally equivalent.Quoted 5 lines
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86,
x86_64and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.
Quoted 4 lines
I must honestly say I really hate the patch. It's a horrible hack and makes fast paths slower. When I designed mempolicies I especially tried to avoid things like that, please don't add them through the backdoor now.
We don't want to be adding horrible hacks and slowness to the core of __alloc_pages().
So where do we stand on this? We made a mess of NUMA policies, and merging "grouping pages by mobility" would fix that mess, only we're not sure that we want to merge those and it's too late for 2.6.23 anwyay?
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Andrew Morton
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Take the horrible hack for .23.
For .24 either merge the mobility or get the other solution that Mel is working on. That solution would only use a single zonelist per node and filter on the fly. That may help performance and also help to make memory policies work better.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Or disable ZONE_MOVABLE until it is usable? I don't think we have the infrastructure to really use it anyways, so it shouldn't make too much difference in terms of features. And it's not that there is some sort of deadline around for it.
Or mark it CONFIG_EXPERIMENTAL with a warning that it'll break NUMA. But disabling is probably better.
Then for .24 or .25 a better solution can be developed.
I would prefer that instead of merging bandaid horrible hacks -- they have a tendency to stay around.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (06/08/07 22:31), Andi Kleen didst pronounce:
Quoted 6 lines
Quoted 4 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Or disable
ZONE_MOVABLEuntil it is usable?
It's usable now. The issue with policies only occurs if the user specifies kernelcore= or movablecore= on the command-line. Your language suggests that you believe policies are not applied when ZONE_MOVABLE is configured at build-time.
Quoted 8 lines
I don't think we have the
infrastructure to really use it anyways, so it shouldn't make too much difference in terms of features. And it's not that there is some sort of deadline around for it.Or mark it
CONFIG_EXPERIMENTALwith a warning that it'll break NUMA. But disabling is probably better.
Saying it breaks NUMA is a excessively strong language. It doesn't break policies in that they still get applied to the highest zone. If kernelcore= or movablecore= is not specified, the behaviour doesn't change.
Quoted 2 lines
Then for .24 or .25 a better solution can be developed.
The better solution in my mind is to always filter the zonelist instead of applying them only for MPOL_BIND zonelists as the hack does.
Quoted 2 lines
I would prefer that instead of merging bandaid horrible hacks -- they have a tendency to stay around.
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 6 lines · On Mon, 6 Aug 2007 22:55:41 +0100 [email protected] (Mel Gorman) wrote:
On (06/08/07 22:31), Andi Kleen didst pronounce:
Quoted 5 lines
Quoted 4 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Quoted 6 lines
Quoted 1 line
Or disable
ZONE_MOVABLEuntil it is usable?It's usable now. The issue with policies only occurs if the user specifies kernelcore= or movablecore= on the command-line. Your language suggests that you believe policies are not applied when
ZONE_MOVABLEis configured at build-time.
So.. the problem which we're fixing here is only present when someone use kernelcore=. This is in fact an argument for _not_ merging the horrible-hack.
How commonly do we expect people to specify kernelcore=? If "not much" then it isn't worth adding the __alloc_pages() overhead?
(It's a pretty darn small overhead, I must say)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (06/08/07 22:12), Andrew Morton didst pronounce:
Quoted 10 lines · On Mon, 6 Aug 2007 22:55:41 +0100 [email protected] (Mel Gorman) wrote:
Quoted 9 lines
On (06/08/07 22:31), Andi Kleen didst pronounce:
Quoted 6 lines
Quoted 4 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Or disable
ZONE_MOVABLEuntil it is usable?
Quoted 9 lines
Quoted 4 lines
It's usable now. The issue with policies only occurs if the user specifies kernelcore= or movablecore= on the command-line. Your language suggests that you believe policies are not applied when
ZONE_MOVABLEis configured at build-time.So.. the problem which we're fixing here is only present when someone use kernelcore=. This is in fact an argument for _not_ merging the horrible-hack.
It's even more constrained than that. It only applies to the MPOL_BIND policy when kernelcore= is specified. The other policies work the same as they ever did.
Quoted 3 lines
How commonly do we expect people to specify kernelcore=? If "not much" then it isn't worth adding the
__alloc_pages()overhead?
For 2.6.23 at least, it'll be "not much". While I'm not keen on leaving MPOL_BIND as it is for 2.6.23, we can postpone the final decision until we've bashed the one-zonelist-per-node patches a bit and see do we want to do that instead.
Quoted 1 line
(It's a pretty darn small overhead, I must say)
And it's simplier than the one-zone-list-per-node patches. The current draft of the patch I'm working on looks something like;
arch/parisc/mm/init.c | 10 ++- drivers/char/sysrq.c | 2 fs/buffer.c | 2 include/linux/gfp.h | 3 - include/linux/mempolicy.h | 2 include/linux/mmzone.h | 42 +++++++++++++++ include/linux/swap.h | 2 mm/mempolicy.c | 6 +- mm/mmzone.c | 28 ++++++++++ mm/oom_kill.c | 8 +-- mm/page_alloc.c | 122 +++++++++++++++++++++------------------------- mm/slab.c | 11 ++-- mm/slub.c | 11 ++-- mm/vmscan.c | 16 +++--- 14 files changed, 164 insertions(+), 101 deletions(-)
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 16 lines · On Tue, 7 Aug 2007 17:55:47 +0100 [email protected] (Mel Gorman) wrote:
On (06/08/07 22:12), Andrew Morton didst pronounce:
Quoted 15 lines · On Mon, 6 Aug 2007 22:55:41 +0100 [email protected] (Mel Gorman) wrote:
Quoted 13 lines
On (06/08/07 22:31), Andi Kleen didst pronounce:
Quoted 6 lines
Quoted 4 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Or disable
ZONE_MOVABLEuntil it is usable?It's usable now. The issue with policies only occurs if the user specifies kernelcore= or movablecore= on the command-line. Your language suggests that you believe policies are not applied when
ZONE_MOVABLEis configured at build-time.
Quoted 8 lines
Quoted 4 lines
So.. the problem which we're fixing here is only present when someone use kernelcore=. This is in fact an argument for _not_ merging the horrible-hack.
It's even more constrained than that. It only applies to the
MPOL_BINDpolicy when kernelcore= is specified. The other policies work the same as they ever did.
so.. should we forget about merging the horrible-hack?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Andrew Morton
Quoted 3 lines
It's even more constrained than that. It only applies to the
MPOL_BINDpolicy when kernelcore= is specified. The other policies work the same as they ever did.so.. should we forget about merging the horrible-hack?
Support MPOL_BIND is a basic NUMA feature. This is going to make .23 unusable for us if kernelcore= is used. If we cannot use kernelcore then NUMA systems cannot use the features that depend on kernelcore.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (07/08/07 11:14), Andrew Morton didst pronounce:
Quoted 23 lines · On Tue, 7 Aug 2007 17:55:47 +0100 [email protected] (Mel Gorman) wrote:
Quoted 22 lines
On (06/08/07 22:12), Andrew Morton didst pronounce:
Quoted 19 lines · On Mon, 6 Aug 2007 22:55:41 +0100 [email protected] (Mel Gorman) wrote:
Quoted 7 lines
On (06/08/07 22:31), Andi Kleen didst pronounce:
Quoted 5 lines
Quoted 4 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
Quoted 6 lines
Quoted 1 line
Or disable
ZONE_MOVABLEuntil it is usable?It's usable now. The issue with policies only occurs if the user specifies kernelcore= or movablecore= on the command-line. Your language suggests that you believe policies are not applied when
ZONE_MOVABLEis configured at build-time.So.. the problem which we're fixing here is only present when someone use kernelcore=. This is in fact an argument for _not_ merging the horrible-hack.
Quoted 5 lines
Quoted 3 lines
It's even more constrained than that. It only applies to the
MPOL_BINDpolicy when kernelcore= is specified. The other policies work the same as they ever did.so.. should we forget about merging the horrible-hack?
Despite a fairly specific case, I'd still like to get the problem fixed for 2.6.23. I've posted up an alternative fix under the subject "Use one zonelist per node instead of multiple zonelists v2". It's a more invasive fix although arguably it's better overall than the hack because it's not dealing with a specific special case and has a sensible path forward that makes policies a saner ultimately. However, unlike the hack it affects all callers of the page allocator so lets see what the reaction from reviewers is before forgetting about the hack altogether.
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Mel Gorman
Despite a fairly specific case, I'd still like to get the problem fixed for 2.6.23. I've posted up an alternative fix under the subject "Use one zonelist per node instead of multiple zonelists v2". It's a more invasive fix although arguably it's better overall than the hack because it's not dealing with a specific special case and has a sensible path forward that makes policies a saner ultimately. However, unlike the hack it affects all callers of the page allocator so lets see what the reaction from reviewers is before forgetting about the hack altogether.
Well its more a precursor to things to come than a hack. If the tests go well for the single zonelist scheme then we may end up doing what the patch did for the mpol_bind zonelists for all allocations.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (06/08/07 12:15), Andrew Morton didst pronounce:
Quoted 24 lines · On Sat, 4 Aug 2007 00:02:17 +0200 Andi Kleen <[email protected]> wrote:
Quoted 18 lines · On Thursday 02 August 2007 19:21:18 Mel Gorman wrote:
Quoted 10 lines
The NUMA layer only supports NUMA policies for the highest zone. When
ZONE_MOVABLEis configured with kernelcore=, the the highest zone becomesZONE_MOVABLE. The result is that policies are only applied to allocations like anonymous pages and page cache allocated fromZONE_MOVABLEwhen the zone is used.This patch applies policies to the two highest zones when the highest zone is
ZONE_MOVABLE. AsZONE_MOVABLEconsists of pages from the highest "real" zone, it's always functionally equivalent.Quoted 5 lines
The patch has been tested on a variety of machines both NUMA and non-NUMA covering x86,
x86_64and ppc64. No abnormal results were seen in kernbench, tbench, dbench or hackbench. It passes regression tests from the numactl package with and without kernelcore= once numactl tests are patched to wait for vmstat counters to update.Quoted 4 lines
I must honestly say I really hate the patch. It's a horrible hack and makes fast paths slower. When I designed mempolicies I especially tried to avoid things like that, please don't add them through the backdoor now.
Quoted 7 lines
We don't want to be adding horrible hacks and slowness to the core of
__alloc_pages().So where do we stand on this? We made a mess of NUMA policies, and merging "grouping pages by mobility" would fix that mess, only we're not sure that we want to merge those and it's too late for 2.6.23 anwyay?
Grouping pages by mobility would still apply polciies only to ZONE_MOVABLE when it is configured. What grouping pages by mobility would relieve is much of the motivation to configure ZONE_MOVABLE at all for hugepages. The zone has such attributes as being useful to hot-remove as well as guaranteeing how much memory can be allocated as hugepages at runtime that is not necessarily provided by grouping pages by mobility.
Quoted 3 lines
If correct, I would suggest merging the horrible hack for .23 then taking it out when we merge "grouping pages by mobility". But what if we don't do that merge?
That hack aspect of the fix is that it alters the hot-path in the allocator. However, there is a logical way forward.
There are patches in the works that change zonelists from having multiple zonelists to only having only one zonelist per node that is filtered based on the allocation flags. The place this filtering happens is the same as what the "hack" is currently doing. The cost of filtering should be offset by the reduced size of the node structure and tests with kernbench, hackbench and tbench seem to confirm that. This will bring the hack into being line with what we wanted with policies in the first place because things like MPOL_BIND will try nodes in node-local order instead of node-numeric order as it does currently.
Quoted 1 line
From there, we can eliminate
policy_zonealtogether by applying policies
to all zones but forcing a situation where MPOL_BIND will always contain one node that GFP_KERNEL allocations can be satisified from. For example, if I have a NUMAQ that only has ZONE_NORMAL on node 0 and a user tries to bind to nodes 2+3, they will really bind to nodes 0,2,3 so that GFP_KERNEL allocations on that process will not return NULL. Alternatively, we could have mbind return a failure if it doesn't include a node that can satisfy GFP_KERNEL allocations. Either of these options seem more sensible than sometimes applying policies and other times not applying them.
The worst aspect is that filtering require many lookups of zone_idx(). However, we may be able to optimise this by keeping the zone index in the pointer within the zonelist as suggested by Christoph Lameter. However, I haven't tried implementing it yet to see what it looks like in practice.
I'm for merging the hack for 2.6.23 and having one-zonelist-per-node ready for 2.6.24. If there is much fear that the hack will persist for too long, I'm ok with applying policies only to ZONE_MOVABLE when kernelcore= is specified on the command line as one-zonelist-per-node can fix the same problem. Ultimately if we agree on patches to eliminate policy_zone altogether, the problem becomes moot as it no longer exists.
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Mel Gorman
Quoted 4 lines
So where do we stand on this? We made a mess of NUMA policies, and merging "grouping pages by mobility" would fix that mess, only we're not sure that we want to merge those and it's too late for 2.6.23 anwyay?
Grouping pages by mobility would still apply polciies only to
ZONE_MOVABLEwhen it is configured. What grouping pages by mobility would relieve is much of the motivation to configureZONE_MOVABLEat all for hugepages. The zone has such attributes as being useful to
Ultimately ZONE_MOVABLE can be removed. AFAIK ZONE_MOVABLE is a temporary stepping stone to address concerns of about defrag reliability. Somehow the stepping stone got into .23 without the real thing.
An additional issue with the current ZONE_MOVABLE in .23 is that the tentative association of ZONE_MOVABLE with HIGHMEM also makes use of large pages by SLUB not possible.
Quoted 9 lines
There are patches in the works that change zonelists from having multiple zonelists to only having only one zonelist per node that is filtered based on the allocation flags. The place this filtering happens is the same as what the "hack" is currently doing. The cost of filtering should be offset by the reduced size of the node structure and tests with kernbench, hackbench and tbench seem to confirm that. This will bring the hack into being line with what we wanted with policies in the first place because things like
MPOL_BINDwill try nodes in node-local order instead of node-numeric order as it does currently.
I'd like to see that patch.
Quoted 9 lines
Quoted 1 line
From there, we can eliminate
policy_zonealtogether by applying policiesto all zones but forcing a situation where
MPOL_BINDwill always contain one node thatGFP_KERNELallocations can be satisified from. For example, if I have a NUMAQ that only hasZONE_NORMALon node 0 and a user tries to bind to nodes 2+3, they will really bind to nodes 0,2,3 so thatGFP_KERNELallocations on that process will not return NULL. Alternatively, we could have mbind return a failure if it doesn't include a node that can satisfyGFP_KERNELallocations. Either of these options seem more sensible than sometimes applying policies and other times not applying them.
We would still need to check on which nodes which zones area available. Zones that are not available on all zones would need to be exempt from policies. Maybe one could define an upper boundary of zones that are policed? On NUMAQ zones up to ZONE_NORMAL would be under policy. On x86_64 this may only include ZONE_DMA. A similar thing would occur on ia64 with the 4G DMA zone. Maybe policy_zone could become configurable?
Quoted 2 lines
I'm for merging the hack for 2.6.23 and having one-zonelist-per-node ready for 2.6.24. If there is much fear that the hack will persist for too
Why not for .23? It does not seem to be too much code?
Quoted 4 lines
long, I'm ok with applying policies only to
ZONE_MOVABLEwhen kernelcore= is specified on the command line as one-zonelist-per-node can fix the same problem. Ultimately if we agree on patches to eliminatepolicy_zonealtogether, the problem becomes moot as it no longer exists.
We cannot have a kernel release with broken mempolicy. We either need the patch here or the one-zonelist patch for .23.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
On (06/08/07 15:31), Christoph Lameter didst pronounce:
Quoted 12 lines · Mel Gorman
Quoted 10 lines
Quoted 5 lines
So where do we stand on this? We made a mess of NUMA policies, and merging "grouping pages by mobility" would fix that mess, only we're not sure that we want to merge those and it's too late for 2.6.23 anwyay?
Grouping pages by mobility would still apply polciies only to
ZONE_MOVABLEwhen it is configured. What grouping pages by mobility would relieve is much of the motivation to configureZONE_MOVABLEat all for hugepages. The zone has such attributes as being useful to
Quoted 8 lines
Ultimately
ZONE_MOVABLEcan be removed. AFAIKZONE_MOVABLEis a temporary stepping stone to address concerns of about defrag reliability. Somehow the stepping stone got into .23 without the real thing.An additional issue with the current
ZONE_MOVABLEin .23 is that the tentative association ofZONE_MOVABLEwith HIGHMEM also makes use of large pages by SLUB not possible.
Pretty much. The use of ZONE_MOVABLE really only applies to hugepages and potentially memory hot-remove right now.
Quoted 10 lines
Quoted 9 lines
There are patches in the works that change zonelists from having multiple zonelists to only having only one zonelist per node that is filtered based on the allocation flags. The place this filtering happens is the same as what the "hack" is currently doing. The cost of filtering should be offset by the reduced size of the node structure and tests with kernbench, hackbench and tbench seem to confirm that. This will bring the hack into being line with what we wanted with policies in the first place because things like
MPOL_BINDwill try nodes in node-local order instead of node-numeric order as it does currently.
Quoted 2 lines
I'd like to see that patch.
I'll find the time to get it implemented this week. I've been prioritising anything that looked like a bug recently so it languished on the TODO pile.
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
From there, we can eliminate
policy_zonealtogether by applying policiesto all zones but forcing a situation where
MPOL_BINDwill always contain one node thatGFP_KERNELallocations can be satisified from. For example, if I have a NUMAQ that only hasZONE_NORMALon node 0 and a user tries to bind to nodes 2+3, they will really bind to nodes 0,2,3 so thatGFP_KERNELallocations on that process will not return NULL. Alternatively, we could have mbind return a failure if it doesn't include a node that can satisfyGFP_KERNELallocations. Either of these options seem more sensible than sometimes applying policies and other times not applying them.
Quoted 7 lines
We would still need to check on which nodes which zones area available. Zones that are not available on all zones would need to be exempt from policies. Maybe one could define an upper boundary of zones that are policed? On NUMAQ zones up to
ZONE_NORMALwould be under policy. Onx86_64this may only includeZONE_DMA. A similar thing would occur on ia64 with the 4G DMA zone. Maybepolicy_zonecould become configurable?
A sensible upper-boundary would be if GFP_KERNEL can be used on zones within that that node or not. gfp_zone(GFP_KERNEL) provides that sort of information and would resolve to ZONE_NORMAL on NUMAQ, ZONE_DMA on ia64 etc. Prehaps that would not work out for GFP_DMA32, I'm not 100% sure at the moment (it's late and this is meant to be a holiday, sue me :) )
This discussion is independent of one-zonelist-per-node which is the stepping stone between where we are now and getting rid of policy_zone altogether.
Quoted 5 lines
Quoted 2 lines
I'm for merging the hack for 2.6.23 and having one-zonelist-per-node ready for 2.6.24. If there is much fear that the hack will persist for too
Why not for .23? It does not seem to be too much code?
I'm working under the assumption that if it's not a bug-fix, you can't get it in after the merge window closes. I've seen complaints before where "bug-fixes" were adding features which one-zonelist-per-node may be preceived by some people to be. Perhaps the rules will flex for this patch when it comes out, perhaps not. I made the assumption that the least invasive bug-fix was sensible outside of the merge window and that's what this hack is.
Quoted 7 lines
Quoted 4 lines
long, I'm ok with applying policies only to
ZONE_MOVABLEwhen kernelcore= is specified on the command line as one-zonelist-per-node can fix the same problem. Ultimately if we agree on patches to eliminatepolicy_zonealtogether, the problem becomes moot as it no longer exists.We cannot have a kernel release with broken mempolicy. We either need the patch here or the one-zonelist patch for .23.
I'll get a sensible version of one-zonelist ASAP. Prehaps we'll end up just going with that altogether if no performance issues are evident in testing.
Signature · 9 lines
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 [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>