From: Miklos Szeredi <miklos@szeredi.hu>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: dirty balancing deadlock
Date: Tue, 20 Feb 2007 00:12:39 +0100 [thread overview]
Message-ID: <E1HJHgV-0007UQ-00@dorka.pomaz.szeredi.hu> (raw)
In-Reply-To: <E1HJC3P-0006tz-00@dorka.pomaz.szeredi.hu> (message from Miklos Szeredi on Mon, 19 Feb 2007 18:11:55 +0100)
> Solves the FUSE deadlock, but not the throttle_vm_writeout() one.
> I'll try to tackle that one as well.
>
> If the per-bdi dirty counter goes below 16, balance_dirty_pages()
> returns.
>
> Does the constant need to tunable? If it's too large, then the global
> threshold is more easily exceeded. If it's too small, then in a tight
> situation progress will be slower.
Similar in spirit, this should solve the deadlock on throttle_vm_writeout().
Totally untested.
Does this approach look workable?
Thanks,
Miklos
Index: linux/include/linux/swap.h
===================================================================
--- linux.orig/include/linux/swap.h 2007-02-19 23:39:36.000000000 +0100
+++ linux/include/linux/swap.h 2007-02-20 00:03:38.000000000 +0100
@@ -277,10 +277,14 @@ static inline void disable_swap_token(vo
put_swap_token(swap_token_mm);
}
+#define nr_swap_writeback \
+ atomic_long_read(&swapper_space.backing_dev_info->nr_writeback)
+
#else /* CONFIG_SWAP */
#define total_swap_pages 0
#define total_swapcache_pages 0UL
+#define nr_swap_writeback 0UL
#define si_swapinfo(val) \
do { (val)->freeswap = (val)->totalswap = 0; } while (0)
Index: linux/mm/page-writeback.c
===================================================================
--- linux.orig/mm/page-writeback.c 2007-02-19 23:43:03.000000000 +0100
+++ linux/mm/page-writeback.c 2007-02-20 00:03:49.000000000 +0100
@@ -33,6 +33,7 @@
#include <linux/syscalls.h>
#include <linux/buffer_head.h>
#include <linux/pagevec.h>
+#include <linux/swap.h>
/*
* The maximum number of pages to writeout in a single bdflush/kupdate
@@ -332,6 +333,9 @@ void throttle_vm_writeout(void)
if (global_page_state(NR_UNSTABLE_NFS) +
global_page_state(NR_WRITEBACK) <= dirty_thresh)
break;
+
+ if (nr_swap_writeback < 16)
+ break;
congestion_wait(WRITE, HZ/10);
}
}
Index: linux/mm/page_io.c
===================================================================
--- linux.orig/mm/page_io.c 2007-02-19 23:24:23.000000000 +0100
+++ linux/mm/page_io.c 2007-02-19 23:42:21.000000000 +0100
@@ -70,6 +70,7 @@ static int end_swap_bio_write(struct bio
ClearPageReclaim(page);
}
end_page_writeback(page);
+ atomic_long_dec(&swapper_space.backing_dev_info->nr_writeback);
bio_put(bio);
return 0;
}
@@ -121,6 +122,7 @@ int swap_writepage(struct page *page, st
if (wbc->sync_mode == WB_SYNC_ALL)
rw |= (1 << BIO_RW_SYNC);
count_vm_event(PSWPOUT);
+ atomic_long_inc(&swapper_space.backing_dev_info->nr_writeback);
set_page_writeback(page);
unlock_page(page);
submit_bio(rw, bio);
--
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:[~2007-02-19 23:12 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-18 18:28 Miklos Szeredi
2007-02-18 20:53 ` Andrew Morton
2007-02-18 21:25 ` Rik van Riel
2007-02-18 22:54 ` Miklos Szeredi
2007-02-18 22:50 ` Miklos Szeredi
2007-02-18 22:59 ` Andrew Morton
2007-02-18 23:22 ` Miklos Szeredi
2007-02-18 23:59 ` Andrew Morton
2007-02-19 0:25 ` Miklos Szeredi
2007-02-19 0:30 ` Miklos Szeredi
2007-02-19 0:45 ` Miklos Szeredi
2007-02-19 0:45 ` Chris Mason
2007-02-19 0:54 ` Miklos Szeredi
2007-02-19 1:01 ` Chris Mason
2007-02-19 1:14 ` Miklos Szeredi
2007-02-20 0:16 ` Chris Mason
2007-02-20 8:53 ` Miklos Szeredi
2007-02-19 17:11 ` Miklos Szeredi
2007-02-19 23:12 ` Miklos Szeredi [this message]
2007-02-20 0:13 ` Chris Mason
2007-02-20 8:47 ` Miklos Szeredi
2007-02-20 11:30 ` Chris Mason
2007-02-21 21:36 ` Andrew Morton
2007-02-22 7:42 ` Miklos Szeredi
2007-02-22 7:55 ` Andrew Morton
2007-02-22 8:02 ` Miklos Szeredi
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=E1HJHgV-0007UQ-00@dorka.pomaz.szeredi.hu \
--to=miklos@szeredi.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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