From: Trond Myklebust <trond.myklebust@fys.uio.no>

--=-ZF2iePfdJEJSqJn3I5IN
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

NFSv2/v3/v4: When pdflush() is trying to free up memory by calling our
writepages() method, throttle all writes to that mountpoint.

NFSv2/v3/v4: Make the struct nfs_page allocator use GFP_KERNEL rather
than GFP_NOFS.

Cheers,
 Trond

--=-ZF2iePfdJEJSqJn3I5IN
Content-Disposition: attachment; filename=linux-2.6.4-04-congestion.dif
Content-Transfer-Encoding: base64
Content-Type: text/plain; name=linux-2.6.4-04-congestion.dif; charset=ISO-8859-1

IHBhZ2VsaXN0LmMgfCAgICAyIC0NCiB3cml0ZS5jICAgIHwgICA4MyArKysrKysrKysrKysrKysr
KysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKy0tLS0tLS0tLS0tDQogMiBmaWxlcyBj
aGFuZ2VkLCA3MCBpbnNlcnRpb25zKCspLCAxNSBkZWxldGlvbnMoLSkNCg0KZGlmZiAtdSAtLXJl
Y3Vyc2l2ZSAtLW5ldy1maWxlIC0tc2hvdy1jLWZ1bmN0aW9uIGxpbnV4LTIuNi40LTIxLXNtYWxs
X3dzaXplL2ZzL25mcy9wYWdlbGlzdC5jIGxpbnV4LTIuNi40LTIyLWNvbmdlc3Rpb24vZnMvbmZz
L3BhZ2VsaXN0LmMNCi0tLSBsaW51eC0yLjYuNC0yMS1zbWFsbF93c2l6ZS9mcy9uZnMvcGFnZWxp
c3QuYwkyMDA0LTAzLTA4IDE4OjE1OjU3LjAwMDAwMDAwMCAtMDUwMA0KKysrIGxpbnV4LTIuNi40
LTIyLWNvbmdlc3Rpb24vZnMvbmZzL3BhZ2VsaXN0LmMJMjAwNC0wMy0wOCAxODoxNjoyMy4wMDAw
MDAwMDAgLTA1MDANCkBAIC0zMiw3ICszMiw3IEBAIHN0YXRpYyBpbmxpbmUgc3RydWN0IG5mc19w
YWdlICoNCiBuZnNfcGFnZV9hbGxvYyh2b2lkKQ0KIHsNCiAJc3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DQogDQogCWVuZCA9IG9mZnNldCArIGJ5dGVzOw0KIA0K
KwlpZiAobmZzX3dhaXRfb25fd3JpdGVfY29uZ2VzdGlvbihwYWdlLT5tYXBwaW5nLCBzZXJ2ZXIt
PmZsYWdzICYgTkZTX01PVU5UX0lOVFIpKQ0KKwkJcmV0dXJuIEVSUl9QVFIoLUVSRVNUQVJUU1lT
KTsNCiAJZm9yICg7Oykgew0KIAkJLyogTG9vcCBvdmVyIGFsbCBpbm9kZSBlbnRyaWVzIGFuZCBz
ZWUgaWYgd2UgZmluZA0KIAkJICogQSByZXF1ZXN0IGZvciB0aGUgcGFnZSB3ZSB3aXNoIHRvIHVw
ZGF0ZQ0K

--=-ZF2iePfdJEJSqJn3I5IN--



---

 25-akpm/fs/nfs/pagelist.c |    2 -
 25-akpm/fs/nfs/write.c    |   83 ++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 70 insertions(+), 15 deletions(-)

diff -puN fs/nfs/pagelist.c~nfs-04-congestion fs/nfs/pagelist.c
--- 25/fs/nfs/pagelist.c~nfs-04-congestion	2004-03-14 15:12:34.967414616 -0800
+++ 25-akpm/fs/nfs/pagelist.c	2004-03-14 15:12:34.970414160 -0800
@@ -32,7 +32,7 @@ static inline struct nfs_page *
 nfs_page_alloc(void)
 {
 	struct nfs_page	*p;
-	p = kmem_cache_alloc(nfs_page_cachep, SLAB_NOFS);
+	p = kmem_cache_alloc(nfs_page_cachep, SLAB_KERNEL);
 	if (p) {
 		memset(p, 0, sizeof(*p));
 		INIT_LIST_HEAD(&p->wb_list);
diff -puN fs/nfs/write.c~nfs-04-congestion fs/nfs/write.c
--- 25/fs/nfs/write.c~nfs-04-congestion	2004-03-14 15:12:34.968414464 -0800
+++ 25-akpm/fs/nfs/write.c	2004-03-14 15:12:34.972413856 -0800
@@ -76,11 +76,15 @@ static struct nfs_page * nfs_update_requ
 					    unsigned int, unsigned int);
 static void nfs_writeback_done_partial(struct nfs_write_data *, int);
 static void nfs_writeback_done_full(struct nfs_write_data *, int);
+static int nfs_wait_on_write_congestion(struct address_space *, int);
+static int nfs_wait_on_requests(struct inode *, unsigned long, unsigned int);
 
 static kmem_cache_t *nfs_wdata_cachep;
 static mempool_t *nfs_wdata_mempool;
 static mempool_t *nfs_commit_mempool;
 
+static DECLARE_WAIT_QUEUE_HEAD(nfs_write_congestion);
+
 static __inline__ struct nfs_write_data *nfs_writedata_alloc(void)
 {
 	struct nfs_write_data	*p;
@@ -259,8 +263,7 @@ static int nfs_writepage_async(struct fi
 /*
  * Write an mmapped page to the server.
  */
-int
-nfs_writepage(struct page *page, struct writeback_control *wbc)
+int nfs_writepage(struct page *page, struct writeback_control *wbc)
 {
 	struct inode *inode = page->mapping->host;
 	unsigned long end_index;
@@ -298,8 +301,11 @@ do_it:
 	lock_kernel();
 	if (!IS_SYNC(inode) && inode_referenced) {
 		err = nfs_writepage_async(NULL, inode, page, 0, offset);
-		if (err >= 0)
+		if (err >= 0) {
 			err = 0;
+			if (wbc->for_reclaim)
+				err = WRITEPAGE_ACTIVATE;
+		}
 	} else {
 		err = nfs_writepage_sync(NULL, inode, page, 0, offset); 
 		if (err == offset)
@@ -307,32 +313,46 @@ do_it:
 	}
 	unlock_kernel();
 out:
-	unlock_page(page);
+	if (err != WRITEPAGE_ACTIVATE)
+		unlock_page(page);
 	if (inode_referenced)
 		iput(inode);
 	return err; 
 }
 
-int
-nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
+/*
+ * Note: causes nfs_update_request() to block on the assumption
+ * 	 that the writeback is generated due to memory pressure.
+ */
+int nfs_writepages(struct address_space *mapping, struct writeback_control *wbc)
 {
+	struct backing_dev_info *bdi = mapping->backing_dev_info;
 	struct inode *inode = mapping->host;
-	int is_sync = !wbc->nonblocking;
 	int err;
 
 	err = generic_writepages(mapping, wbc);
 	if (err)
-		goto out;
+		return err;
+	while (test_and_set_bit(BDI_write_congested, &bdi->state) != 0) {
+		if (wbc->nonblocking)
+			return 0;
+		nfs_wait_on_write_congestion(mapping, 0);
+	}
 	err = nfs_flush_inode(inode, 0, 0, 0);
 	if (err < 0)
 		goto out;
-	if (wbc->sync_mode == WB_SYNC_HOLD)
-		goto out;
-	if (is_sync && wbc->sync_mode == WB_SYNC_ALL) {
-		err = nfs_wb_all(inode);
-	} else
-		nfs_commit_inode(inode, 0, 0, 0);
+	wbc->nr_to_write -= err;
+	if (!wbc->nonblocking && wbc->sync_mode == WB_SYNC_ALL) {
+		err = nfs_wait_on_requests(inode, 0, 0);
+		if (err < 0)
+			goto out;
+	}
+	err = nfs_commit_inode(inode, 0, 0, 0);
+	if (err > 0)
+		wbc->nr_to_write -= err;
 out:
+	clear_bit(BDI_write_congested, &bdi->state);
+	wake_up_all(&nfs_write_congestion);
 	return err;
 }
 
@@ -544,6 +564,38 @@ nfs_scan_commit(struct inode *inode, str
 }
 #endif
 
+static int nfs_wait_on_write_congestion(struct address_space *mapping, int intr)
+{
+	struct backing_dev_info *bdi = mapping->backing_dev_info;
+	DEFINE_WAIT(wait);
+	int ret = 0;
+
+	might_sleep();
+
+	if (!bdi_write_congested(bdi))
+		return 0;
+	if (intr) {
+		struct rpc_clnt *clnt = NFS_CLIENT(mapping->host);
+		sigset_t oldset;
+
+		rpc_clnt_sigmask(clnt, &oldset);
+		prepare_to_wait(&nfs_write_congestion, &wait, TASK_INTERRUPTIBLE);
+		if (bdi_write_congested(bdi)) {
+			if (signalled())
+				ret = -ERESTARTSYS;
+			else
+				schedule();
+		}
+		rpc_clnt_sigunmask(clnt, &oldset);
+	} else {
+		prepare_to_wait(&nfs_write_congestion, &wait, TASK_UNINTERRUPTIBLE);
+		if (bdi_write_congested(bdi))
+			schedule();
+	}
+	finish_wait(&nfs_write_congestion, &wait);
+	return ret;
+}
+
 
 /*
  * Try to update any existing write request, or create one if there is none.
@@ -556,11 +608,14 @@ static struct nfs_page *
 nfs_update_request(struct file* file, struct inode *inode, struct page *page,
 		   unsigned int offset, unsigned int bytes)
 {
+	struct nfs_server *server = NFS_SERVER(inode);
 	struct nfs_page		*req, *new = NULL;
 	unsigned long		rqend, end;
 
 	end = offset + bytes;
 
+	if (nfs_wait_on_write_congestion(page->mapping, server->flags & NFS_MOUNT_INTR))
+		return ERR_PTR(-ERESTARTSYS);
 	for (;;) {
 		/* Loop over all inode entries and see if we find
 		 * A request for the page we wish to update

_