lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181007232736.3780-19-martin@omnibond.com>
Date:   Sun,  7 Oct 2018 23:27:35 +0000
From:   Martin Brandenburg <martin@...ibond.com>
To:     devel@...ts.orangefs.org, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, hubcap@...ibond.com
Cc:     Martin Brandenburg <martin@...ibond.com>
Subject: [PATCH 18/19] orangefs: use client-core buffer size to determine writepages count

The previous fixed count of 128 was arbitrary.

I see about a 10% performance increase on large block size I/O since
the count is now 1024 (given the default four megabyte client-core
buffer).

Signed-off-by: Martin Brandenburg <martin@...ibond.com>
---
 fs/orangefs/inode.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 9a41b7d2ce54..20950f3f758a 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -15,8 +15,6 @@
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
 
-#define ORANGEFS_WRITEPAGES_COUNT 128
-
 static int orangefs_writepage_locked(struct page *page,
     struct writeback_control *wbc)
 {
@@ -237,9 +235,10 @@ struct orangefs_writepages {
 	size_t len;
 	kuid_t uid;
 	kgid_t gid;
-	struct page *pages[ORANGEFS_WRITEPAGES_COUNT];
+	int maxpages;
 	int npages;
-	struct bio_vec bv[ORANGEFS_WRITEPAGES_COUNT];
+	struct page **pages;
+	struct bio_vec *bv;
 };
 
 static int orangefs_writepages_work(struct orangefs_writepages *ow,
@@ -324,7 +323,7 @@ static int orangefs_writepages_callback(struct page *page,
 		}
 		if (!uid_eq(ow->uid, wr->uid) || !gid_eq(ow->gid, wr->gid)) {
 			orangefs_writepages_work(ow, wbc);
-			memset(ow, 0, sizeof *ow);
+			ow->npages = 0;
 			ret = -1;
 			goto done;
 		}
@@ -340,9 +339,9 @@ static int orangefs_writepages_callback(struct page *page,
 			mapping_set_error(page->mapping, ret);
 			unlock_page(page);
 		} else {
-			if (ow->npages == ORANGEFS_WRITEPAGES_COUNT) {
+			if (ow->npages == ow->maxpages) {
 				orangefs_writepages_work(ow, wbc);
-				memset(ow, 0, sizeof *ow);
+				ow->npages = 0;
 			}
 		}
 	}
@@ -358,6 +357,18 @@ static int orangefs_writepages(struct address_space *mapping,
 	ow = kzalloc(sizeof(struct orangefs_writepages), GFP_KERNEL);
 	if (!ow)
 		return -ENOMEM;
+	ow->maxpages = orangefs_bufmap_size_query()/PAGE_SIZE;
+	ow->pages = kcalloc(ow->maxpages, sizeof(struct page *), GFP_KERNEL);
+	if (!ow->pages) {
+		kfree(ow);
+		return -ENOMEM;
+	}
+	ow->bv = kcalloc(ow->maxpages, sizeof(struct bio_vec), GFP_KERNEL);
+	if (!ow->bv) {
+		kfree(ow->pages);
+		kfree(ow);
+		return -ENOMEM;
+	}
 	mutex_lock(&ORANGEFS_SB(mapping->host->i_sb)->writepages_mutex);
 	blk_start_plug(&plug);
 	ret = write_cache_pages(mapping, wbc, orangefs_writepages_callback, ow);
@@ -365,6 +376,8 @@ static int orangefs_writepages(struct address_space *mapping,
 		ret = orangefs_writepages_work(ow, wbc);
 	blk_finish_plug(&plug);
 	mutex_unlock(&ORANGEFS_SB(mapping->host->i_sb)->writepages_mutex);
+	kfree(ow->pages);
+	kfree(ow->bv);
 	kfree(ow);
 	return ret;
 }
-- 
2.19.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ