From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
torvalds@linux-foundation.org, akpm@linux-foundation.org,
alan@lxorguk.ukuu.org.uk, Rik van Riel <riel@redhat.com>,
Johannes Weiner <jweiner@redhat.com>,
Mel Gorman <mgorman@suse.de>,
Andrea Arcangeli <aarcange@redhat.com>,
Minchan Kim <minchan.kim@gmail.com>
Subject: [ 15/41] vmscan: limit direct reclaim for higher order allocations
Date: Mon, 30 Jul 2012 10:31:14 -0700 [thread overview]
Message-ID: <20120730172902.497265875@linuxfoundation.org> (raw)
In-Reply-To: <20120730172901.306897424@linuxfoundation.org>
From: Greg KH <gregkh@linuxfoundation.org>
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rik van Riel <riel@redhat.com>
commit e0887c19b2daa140f20ca8104bdc5740f39dbb86 upstream.
Stable note: Not tracked on Bugzilla. THP and compaction was found to
aggressively reclaim pages and stall systems under different
situations that was addressed piecemeal over time. Paragraph
3 of this changelog is the motivation for this patch.
When suffering from memory fragmentation due to unfreeable pages, THP page
faults will repeatedly try to compact memory. Due to the unfreeable
pages, compaction fails.
Needless to say, at that point page reclaim also fails to create free
contiguous 2MB areas. However, that doesn't stop the current code from
trying, over and over again, and freeing a minimum of 4MB (2UL <<
sc->order pages) at every single invocation.
This resulted in my 12GB system having 2-3GB free memory, a corresponding
amount of used swap and very sluggish response times.
This can be avoided by having the direct reclaim code not reclaim from
zones that already have plenty of free memory available for compaction.
If compaction still fails due to unmovable memory, doing additional
reclaim will only hurt the system, not help.
[jweiner@redhat.com: change comment to explain the order check]
Signed-off-by: Rik van Riel <riel@redhat.com>
Acked-by: Johannes Weiner <jweiner@redhat.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/vmscan.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2059,6 +2059,22 @@ static void shrink_zones(int priority, s
continue;
if (zone->all_unreclaimable && priority != DEF_PRIORITY)
continue; /* Let kswapd poll it */
+ if (COMPACTION_BUILD) {
+ /*
+ * If we already have plenty of memory
+ * free for compaction, don't free any
+ * more. Even though compaction is
+ * invoked for any non-zero order,
+ * only frequent costly order
+ * reclamation is disruptive enough to
+ * become a noticable problem, like
+ * transparent huge page allocations.
+ */
+ if (sc->order > PAGE_ALLOC_COSTLY_ORDER &&
+ (compaction_suitable(zone, sc->order) ||
+ compaction_deferred(zone)))
+ continue;
+ }
/*
* This steals pages from memory cgroups over softlimit
* and returns the number of reclaimed pages and
next prev parent reply other threads:[~2012-07-30 17:46 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-30 17:30 [ 00/41] 3.0.39-rc2 stable review Greg Kroah-Hartman
2012-07-30 17:31 ` [ 01/41] cifs: always update the inode cache with the results from a FIND_* Greg Kroah-Hartman
2012-07-30 17:31 ` [ 02/41] ntp: Fix STA_INS/DEL clearing bug Greg Kroah-Hartman
2012-07-30 17:31 ` [ 03/41] mm: fix lost kswapd wakeup in kswapd_stop() Greg Kroah-Hartman
2012-07-30 17:31 ` [ 04/41] MIPS: Properly align the .data..init_task section Greg Kroah-Hartman
2012-07-30 17:31 ` [ 05/41] UBIFS: fix a bug in empty space fix-up Greg Kroah-Hartman
2012-07-30 17:31 ` [ 06/41] dm raid1: fix crash with mirror recovery and discard Greg Kroah-Hartman
2012-07-30 17:31 ` [ 07/41] mm/vmstat.c: cache align vm_stat Greg Kroah-Hartman
2012-07-30 17:31 ` [ 08/41] mm: memory hotplug: Check if pages are correctly reserved on a per-section basis Greg Kroah-Hartman
2012-07-30 17:31 ` [ 09/41] mm: reduce the amount of work done when updating min_free_kbytes Greg Kroah-Hartman
2012-07-30 17:31 ` [ 10/41] mm: vmscan: fix force-scanning small targets without swap Greg Kroah-Hartman
2012-07-30 17:31 ` [ 11/41] vmscan: clear ZONE_CONGESTED for zone with good watermark Greg Kroah-Hartman
2012-07-30 17:31 ` [ 12/41] vmscan: add shrink_slab tracepoints Greg Kroah-Hartman
2012-07-30 17:31 ` [ 13/41] vmscan: shrinker->nr updates race and go wrong Greg Kroah-Hartman
2012-07-30 17:31 ` [ 14/41] vmscan: reduce wind up shrinker->nr when shrinker cant do work Greg Kroah-Hartman
2012-07-30 17:31 ` Greg Kroah-Hartman [this message]
2012-07-30 17:31 ` [ 16/41] vmscan: abort reclaim/compaction if compaction can proceed Greg Kroah-Hartman
2012-07-30 17:31 ` [ 17/41] mm: compaction: trivial clean up in acct_isolated() Greg Kroah-Hartman
2012-07-30 17:31 ` [ 18/41] mm: change isolate mode from #define to bitwise type Greg Kroah-Hartman
2012-07-30 17:31 ` [ 19/41] mm: compaction: make isolate_lru_page() filter-aware Greg Kroah-Hartman
2012-07-30 17:31 ` [ 20/41] mm: zone_reclaim: " Greg Kroah-Hartman
2012-07-30 17:31 ` [ 21/41] mm: migration: clean up unmap_and_move() Greg Kroah-Hartman
2012-07-30 17:31 ` [ 22/41] mm: compaction: allow compaction to isolate dirty pages Greg Kroah-Hartman
2012-07-30 17:31 ` [ 23/41] mm: compaction: determine if dirty pages can be migrated without blocking within ->migratepage Greg Kroah-Hartman
2012-07-30 17:31 ` [ 24/41] mm: page allocator: do not call direct reclaim for THP allocations while compaction is deferred Greg Kroah-Hartman
2012-07-30 17:31 ` [ 25/41] mm: compaction: make isolate_lru_page() filter-aware again Greg Kroah-Hartman
2012-07-30 17:31 ` [ 26/41] kswapd: avoid unnecessary rebalance after an unsuccessful balancing Greg Kroah-Hartman
2012-07-30 17:31 ` [ 27/41] kswapd: assign new_order and new_classzone_idx after wakeup in sleeping Greg Kroah-Hartman
2012-07-30 17:31 ` [ 28/41] mm: compaction: introduce sync-light migration for use by compaction Greg Kroah-Hartman
2012-07-31 16:43 ` Herton Ronaldo Krzesinski
2012-07-31 17:00 ` Greg Kroah-Hartman
2012-07-30 17:31 ` [ 29/41] mm: vmscan: when reclaiming for compaction, ensure there are sufficient free pages available Greg Kroah-Hartman
2012-07-30 17:31 ` [ 30/41] mm: vmscan: do not OOM if aborting reclaim to start compaction Greg Kroah-Hartman
2012-07-30 17:31 ` [ 31/41] mm: vmscan: check if reclaim should really abort even if compaction_ready() is true for one zone Greg Kroah-Hartman
2012-07-30 17:31 ` [ 32/41] vmscan: promote shared file mapped pages Greg Kroah-Hartman
2012-07-30 17:31 ` [ 33/41] vmscan: activate executable pages after first usage Greg Kroah-Hartman
2012-07-30 17:31 ` [ 34/41] mm/vmscan.c: consider swap space when deciding whether to continue reclaim Greg Kroah-Hartman
2012-07-30 17:31 ` [ 35/41] mm: test PageSwapBacked in lumpy reclaim Greg Kroah-Hartman
2012-07-30 17:31 ` [ 36/41] mm: vmscan: convert global reclaim to per-memcg LRU lists Greg Kroah-Hartman
2012-07-30 17:31 ` [ 37/41] cpusets: avoid looping when storing to mems_allowed if one node remains set Greg Kroah-Hartman
2012-07-30 17:31 ` [ 38/41] cpusets: stall when updating mems_allowed for mempolicy or disjoint nodemask Greg Kroah-Hartman
2012-07-30 17:31 ` [ 39/41] cpuset: mm: reduce large amounts of memory barrier related damage v3 Greg Kroah-Hartman
2012-07-30 17:31 ` [ 40/41] mm/hugetlb: fix warning in alloc_huge_page/dequeue_huge_page_vma Greg Kroah-Hartman
2012-07-30 17:31 ` [ 41/41] vmscan: fix initial shrinker size handling Greg Kroah-Hartman
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=20120730172902.497265875@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jweiner@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.com \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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