* Re: [patch 15/24] mm: page_alloc: exclude unreclaimable allocations from zone fairness policy
[not found] <20131219010847.E56B731C2B8@corp2gmr1-1.hot.corp.google.com>
@ 2013-12-19 15:41 ` Johannes Weiner
2013-12-19 21:00 ` Linus Torvalds
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Weiner @ 2013-12-19 15:41 UTC (permalink / raw)
To: akpm; +Cc: torvalds, dave.hansen, mgorman, riel, stable, mhocko, linux-mm
On Wed, Dec 18, 2013 at 05:08:47PM -0800, akpm@linux-foundation.org wrote:
> From: Johannes Weiner <hannes@cmpxchg.org>
> Subject: mm: page_alloc: exclude unreclaimable allocations from zone fairness policy
>
> Dave Hansen noted a regression in a microbenchmark that loops around
> open() and close() on an 8-node NUMA machine and bisected it down to
> 81c0a2bb515f ("mm: page_alloc: fair zone allocator policy"). That change
> forces the slab allocations of the file descriptor to spread out to all 8
> nodes, causing remote references in the page allocator and slab.
>
> The round-robin policy is only there to provide fairness among memory
> allocations that are reclaimed involuntarily based on pressure in each
> zone. It does not make sense to apply it to unreclaimable kernel
> allocations that are freed manually, in this case instantly after the
> allocation, and incur the remote reference costs twice for no reason.
>
> Only round-robin allocations that are usually freed through page reclaim
> or slab shrinking.
>
> Bisected by Dave Hansen.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Dave Hansen <dave.hansen@intel.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Reviewed-by: Rik van Riel <riel@redhat.com>
> Cc: <stable@kernel.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Linus, I did not see this patch show up in your tree yet, so if it's
not too late, please consider merging the following patch instead to
disable NUMA aspects of the fairness allocator entirely until we can
agree on how it should behave, how it should be configurable etc.:
---
From: Johannes Weiner <hannes@cmpxchg.org>
Subject: [patch] mm: page_alloc: revert NUMA aspect of fair allocation policy
81c0a2bb ("mm: page_alloc: fair zone allocator policy") meant to bring
aging fairness among zones in system, but it was overzealous and badly
regressed basic workloads on NUMA systems.
Due to the way kswapd and page allocator interacts, we still want to
make sure that all zones in any given node are used equally for all
allocations to maximize memory utilization and prevent thrashing on
the highest zone in the node.
While the same principle applies to NUMA nodes - memory utilization is
obviously improved by spreading allocations throughout all nodes -
remote references can be costly and so many workloads prefer locality
over memory utilization. The original change assumed that
zone_reclaim_mode would be a good enough predictor for that, but it
turned out to be as indicative as a coin flip.
Revert the NUMA aspect of the fairness until we can find a proper way
to make it configurable and agree on a sane default.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: <stable@kernel.org> # 3.12
---
mm/page_alloc.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 580a5f075ed0..5248fe070aa4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1816,7 +1816,7 @@ static void zlc_clear_zones_full(struct zonelist *zonelist)
static bool zone_local(struct zone *local_zone, struct zone *zone)
{
- return node_distance(local_zone->node, zone->node) == LOCAL_DISTANCE;
+ return local_zone->node == zone->node;
}
static bool zone_allows_reclaim(struct zone *local_zone, struct zone *zone)
@@ -1913,18 +1913,17 @@ zonelist_scan:
* page was allocated in should have no effect on the
* time the page has in memory before being reclaimed.
*
- * When zone_reclaim_mode is enabled, try to stay in
- * local zones in the fastpath. If that fails, the
- * slowpath is entered, which will do another pass
- * starting with the local zones, but ultimately fall
- * back to remote zones that do not partake in the
- * fairness round-robin cycle of this zonelist.
+ * Try to stay in local zones in the fastpath. If
+ * that fails, the slowpath is entered, which will do
+ * another pass starting with the local zones, but
+ * ultimately fall back to remote zones that do not
+ * partake in the fairness round-robin cycle of this
+ * zonelist.
*/
if (alloc_flags & ALLOC_WMARK_LOW) {
if (zone_page_state(zone, NR_ALLOC_BATCH) <= 0)
continue;
- if (zone_reclaim_mode &&
- !zone_local(preferred_zone, zone))
+ if (!zone_local(preferred_zone, zone))
continue;
}
/*
@@ -2390,7 +2389,7 @@ static void prepare_slowpath(gfp_t gfp_mask, unsigned int order,
* thrash fairness information for zones that are not
* actually part of this zonelist's round-robin cycle.
*/
- if (zone_reclaim_mode && !zone_local(preferred_zone, zone))
+ if (!zone_local(preferred_zone, zone))
continue;
mod_zone_page_state(zone, NR_ALLOC_BATCH,
high_wmark_pages(zone) -
--
1.8.4.2
--
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>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch 15/24] mm: page_alloc: exclude unreclaimable allocations from zone fairness policy
2013-12-19 15:41 ` [patch 15/24] mm: page_alloc: exclude unreclaimable allocations from zone fairness policy Johannes Weiner
@ 2013-12-19 21:00 ` Linus Torvalds
0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2013-12-19 21:00 UTC (permalink / raw)
To: Johannes Weiner
Cc: Andrew Morton, Dave Hansen, Mel Gorman, Rik van Riel, # .39.x,
Michal Hocko, linux-mm
On Thu, Dec 19, 2013 at 7:41 AM, Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> Linus, I did not see this patch show up in your tree yet
Oh, it's there. Commit 73f038b863dfe98acabc7c36c17342b84ad52e94.
> so if it's
> not too late, please consider merging the following patch instead to
> disable NUMA aspects of the fairness allocator entirely until we can
> agree on how it should behave, how it should be configurable etc.:
I'm ok with disabling it if that's what people want, but please send
an updated patch with acks etc on top of the current tree..
Linus
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-19 21:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20131219010847.E56B731C2B8@corp2gmr1-1.hot.corp.google.com>
2013-12-19 15:41 ` [patch 15/24] mm: page_alloc: exclude unreclaimable allocations from zone fairness policy Johannes Weiner
2013-12-19 21:00 ` Linus Torvalds
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).