From: Andrea Arcangeli <aarcange@redhat.com>
To: "Alex Villacís Lasso" <avillaci@fiec.espol.edu.ec>
Cc: Mel Gorman <mel@csn.ul.ie>,
Andrew Morton <akpm@linux-foundation.org>,
avillaci@ceibo.fiec.espol.edu.ec,
bugzilla-daemon@bugzilla.kernel.org,
bugme-daemon@bugzilla.kernel.org, linux-mm@kvack.org
Subject: Re: [Bugme-new] [Bug 31142] New: Large write to USB stick freezes unrelated tasks for a long time
Date: Sun, 20 Mar 2011 00:51:44 +0100 [thread overview]
Message-ID: <20110319235144.GG10696@random.random> (raw)
In-Reply-To: <4D84D3F2.4010200@fiec.espol.edu.ec>
On Sat, Mar 19, 2011 at 11:04:02AM -0500, Alex Villaci-s Lasso wrote:
> The patch did not help. I have attached a sysrq-w trace with the patch applied in the bug report.
Most processes are stuck in udf_writepage. That's because migrate is
calling ->writepage on dirty pages even when sync=0.
This may do better, can you test it in replacement of the previous
patch?
Thanks,
Andrea
===
Subject: compaction: use async migrate for __GFP_NO_KSWAPD
From: Andrea Arcangeli <aarcange@redhat.com>
__GFP_NO_KSWAPD allocations are usually very expensive and not mandatory to
succeed (they have graceful fallback). Waiting for I/O in those, tends to be
overkill in terms of latencies, so we can reduce their latency by disabling
sync migrate.
Stop calling ->writepage on dirty cache when migrate sync mode is not set.
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---
mm/migrate.c | 35 ++++++++++++++++++++++++++---------
mm/page_alloc.c | 2 +-
2 files changed, 27 insertions(+), 10 deletions(-)
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2085,7 +2085,7 @@ rebalance:
sync_migration);
if (page)
goto got_pg;
- sync_migration = true;
+ sync_migration = !(gfp_mask & __GFP_NO_KSWAPD);
/* Try direct reclaim and then allocating */
page = __alloc_pages_direct_reclaim(gfp_mask, order,
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -536,10 +536,15 @@ static int writeout(struct address_space
* Default handling if a filesystem does not provide a migration function.
*/
static int fallback_migrate_page(struct address_space *mapping,
- struct page *newpage, struct page *page)
+ struct page *newpage, struct page *page,
+ int sync)
{
- if (PageDirty(page))
- return writeout(mapping, page);
+ if (PageDirty(page)) {
+ if (sync)
+ return writeout(mapping, page);
+ else
+ return -EBUSY;
+ }
/*
* Buffers may be managed in a filesystem specific way.
@@ -564,7 +569,7 @@ static int fallback_migrate_page(struct
* == 0 - success
*/
static int move_to_new_page(struct page *newpage, struct page *page,
- int remap_swapcache)
+ int remap_swapcache, int sync)
{
struct address_space *mapping;
int rc;
@@ -597,7 +602,7 @@ static int move_to_new_page(struct page
rc = mapping->a_ops->migratepage(mapping,
newpage, page);
else
- rc = fallback_migrate_page(mapping, newpage, page);
+ rc = fallback_migrate_page(mapping, newpage, page, sync);
if (rc) {
newpage->mapping = NULL;
@@ -641,6 +646,10 @@ static int unmap_and_move(new_page_t get
rc = -EAGAIN;
if (!trylock_page(page)) {
+ if (!sync) {
+ rc = -EBUSY;
+ goto move_newpage;
+ }
if (!force)
goto move_newpage;
@@ -686,7 +695,11 @@ static int unmap_and_move(new_page_t get
BUG_ON(charge);
if (PageWriteback(page)) {
- if (!force || !sync)
+ if (!sync) {
+ rc = -EBUSY;
+ goto uncharge;
+ }
+ if (!force)
goto uncharge;
wait_on_page_writeback(page);
}
@@ -757,7 +770,7 @@ static int unmap_and_move(new_page_t get
skip_unmap:
if (!page_mapped(page))
- rc = move_to_new_page(newpage, page, remap_swapcache);
+ rc = move_to_new_page(newpage, page, remap_swapcache, sync);
if (rc && remap_swapcache)
remove_migration_ptes(page, page);
@@ -834,7 +847,11 @@ static int unmap_and_move_huge_page(new_
rc = -EAGAIN;
if (!trylock_page(hpage)) {
- if (!force || !sync)
+ if (!sync) {
+ rc = -EBUSY;
+ goto out;
+ }
+ if (!force)
goto out;
lock_page(hpage);
}
@@ -850,7 +867,7 @@ static int unmap_and_move_huge_page(new_
try_to_unmap(hpage, TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);
if (!page_mapped(hpage))
- rc = move_to_new_page(new_hpage, hpage, 1);
+ rc = move_to_new_page(new_hpage, hpage, 1, sync);
if (rc)
remove_migration_ptes(hpage, hpage);
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-03-19 23:52 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-31142-10286@https.bugzilla.kernel.org/>
2011-03-15 20:53 ` [Bugme-new] [Bug 31142] New: Large write to USB stick freezes unrelated tasks for a long time Andrew Morton
2011-03-15 22:53 ` Alex Villacís Lasso
2011-03-15 23:19 ` Andrew Morton
2011-03-16 15:25 ` Alex Villacís Lasso
2011-03-16 22:02 ` Andrew Morton
2011-03-17 21:27 ` Alex Villacís Lasso
2011-03-17 21:47 ` Andrew Morton
2011-03-17 22:11 ` Alex Villacís Lasso
2011-03-17 22:25 ` Andrew Morton
2011-03-18 11:13 ` Mel Gorman
2011-03-18 12:26 ` Andrea Arcangeli
2011-03-18 18:05 ` Alex Villacís Lasso
2011-03-19 13:46 ` Mel Gorman
2011-03-19 16:04 ` Alex Villacís Lasso
2011-03-19 23:51 ` Andrea Arcangeli [this message]
2011-03-21 9:41 ` Mel Gorman
2011-03-21 13:48 ` Andrea Arcangeli
2011-03-21 15:22 ` Alex Villacís Lasso
2011-03-21 15:36 ` Alex Villacís Lasso
2011-03-21 15:40 ` Andrea Arcangeli
2011-03-21 16:37 ` Mel Gorman
2011-03-21 17:05 ` Alex Villacís Lasso
2011-03-21 20:16 ` Andrea Arcangeli
2011-03-21 23:35 ` Alex Villacís Lasso
2011-03-22 11:20 ` Mel Gorman
2011-03-22 15:03 ` Andrea Arcangeli
2011-03-22 20:34 ` Alex Villacís Lasso
2011-03-22 21:40 ` Andrea Arcangeli
2011-03-23 0:37 ` Andrea Arcangeli
2011-03-23 16:51 ` Alex Villacís Lasso
2011-04-04 15:37 ` Alex Villacís Lasso
2011-04-08 19:09 ` Andrea Arcangeli
2011-04-08 20:06 ` Alex Villacís Lasso
2011-04-12 16:27 ` Alex Villacís Lasso
2011-04-14 17:25 ` Alex Villacís Lasso
2011-04-14 17:37 ` Andrea Arcangeli
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=20110319235144.GG10696@random.random \
--to=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=avillaci@ceibo.fiec.espol.edu.ec \
--cc=avillaci@fiec.espol.edu.ec \
--cc=bugme-daemon@bugzilla.kernel.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mel@csn.ul.ie \
/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;
as well as URLs for NNTP newsgroup(s).