Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2964318imm; Sun, 7 Oct 2018 16:29:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV61h2uBPknP8oFxl/opUtovPyGICblMorsL2J+h6FM6CtGhHHu8YqcUNZKsYgVbdweCsLKrz X-Received: by 2002:a63:1d10:: with SMTP id d16-v6mr18204144pgd.228.1538954960404; Sun, 07 Oct 2018 16:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538954960; cv=none; d=google.com; s=arc-20160816; b=uMSng//wS5N0xhLuN9yrqfDdGdrtMp58PeNg9pJ3UddtuVy1HbovvOwBiKSRXkhSeQ I4mgzVAUQHakzeopJcmwuoHWhUuYqg7tNNvVPq14xCGWQiKMNYO+dZJC3tibsboF6Opl QBWTiCIAsB/jJ6PMsrMXrmMezrwUa1R7WI7rmY6B49CkJ/+Ugsu6nP258HpiZcu8wHxz Si2P4linMEOfqw25bUe9coDPYOixV04xzS6eiE23VWAwxxTAC+FSW8AedcZwzXVcfG2Z 6dc4rA3CjWZmpxA7aWsjZQpHX3sEUdHWMkEHT+XHvr9TJQ3RyPT3l15iInn/ccaka2Ug JU2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PEEqfvkw1I9tFvFaX8GvqLlehC3qvmeeopO1s4P8jGE=; b=PbnA4q9z8XalYsvqE+9LM7vKbeJ1J049WGH5AHZlSCuB7mgzCF+Ov4xUdT7TY5yBqP StAIPrZ8C5IYNbwaZ4x0B0AZGBP08uBTL70tc7kl3Y/do8XA6dUYqfyp2/0tutpC9hZ5 Z84remXCEWKu9zTtvkV2PKPxOqVb70PWtY3I0UNWm2NchvmSr/3++2sWHJeaoBnfCu0k M9h8K5ZXkb7V8RQ2cPnO7+xSbJu3LgmPV6zK8QZnQsYyTrhK8t7Zr/vLub50KUrEjyhN KH6+MiVcC1Cq7NoW3CZvosgc8XG37eUNtelINA3Xb2jymo76z6RBkdwol9Qp/pWGQJAt k/WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@omnibond-com.20150623.gappssmtp.com header.s=20150623 header.b=TJ+uTx5r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m16-v6si14982912pgd.48.2018.10.07.16.28.51; Sun, 07 Oct 2018 16:29:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@omnibond-com.20150623.gappssmtp.com header.s=20150623 header.b=TJ+uTx5r; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728541AbeJHGhP (ORCPT + 99 others); Mon, 8 Oct 2018 02:37:15 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41309 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727761AbeJHGhN (ORCPT ); Mon, 8 Oct 2018 02:37:13 -0400 Received: by mail-qt1-f195.google.com with SMTP id l41-v6so6700906qtl.8 for ; Sun, 07 Oct 2018 16:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omnibond-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PEEqfvkw1I9tFvFaX8GvqLlehC3qvmeeopO1s4P8jGE=; b=TJ+uTx5rdz4nAZNebJilZJ3eME3EA0fgKkZPq19X8YIScVJGVuad3wUKUrnaulLa94 ZXVKp7IoqA71x0ScCdkmxolMLnYyUo7ccSPca9a3vR3ln3/xGmsgpvhMtKY9EvkNL//R sww/1FaJEaOqORCyzrfecUIE/aq4EeOOtbaWLiVv0Za4K/EaWh71Qr/UMvBPQmPDe9Tw wYyK+dEC2cGPePHw1InVR9AiZrSe2ae7LEHk73nIjkjvKzfkh1yLBMYXR92oLCTSk3CD lkYqJwcBy9zZr3qgh+MtdjQ/36F83bzKyINbKVTx4EIbx1F2es0VrQMUenqjvM5aUKCo BB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PEEqfvkw1I9tFvFaX8GvqLlehC3qvmeeopO1s4P8jGE=; b=lpjI2mrZWPer6KzPXqBh0oOELnr6cuEAEMglOvRkBCniHX2ZPZR1KBubhpVXJaajnB fUXIYLgpUYa/Wvg+mc41XMig4NPfsGRz/0IIXrSDqn5B9LCORuNmQTXGV8AseeBONBvq xoecREpoL0TwGrTj6Q0grvaPOeWPpAJb9cZAWc2nUNHJVtakSxTgnJriit5IuxMuCKaS nPKvjeQ8EWwujl/vHvDI6B2TZShD4QCnYphSIyuQfyNKFOQRZurnue9gGsbXyALzNbiz pMPNjTZ6XwSa3lxc20LznErpg2qA727mEZqPld6AAk1EohKFd6NUZeWpik2b+2W1Z6eG 9/MA== X-Gm-Message-State: ABuFfojY0qIPfkE55m1ce4oIriUX/JoFKWgQmiQboTefGnMIZ3gQahs7 NzetpEX4A+BEtO9A7RHhwh49mA== X-Received: by 2002:a0c:d267:: with SMTP id o36mr3349885qvh.235.1538954899350; Sun, 07 Oct 2018 16:28:19 -0700 (PDT) Received: from ip-172-31-22-34.ec2.internal (ec2-35-153-175-159.compute-1.amazonaws.com. [35.153.175.159]) by smtp.gmail.com with ESMTPSA id x38-v6sm6793915qtc.39.2018.10.07.16.28.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Oct 2018 16:28:18 -0700 (PDT) From: Martin Brandenburg To: devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hubcap@omnibond.com Cc: Martin Brandenburg Subject: [PATCH 18/19] orangefs: use client-core buffer size to determine writepages count Date: Sun, 7 Oct 2018 23:27:35 +0000 Message-Id: <20181007232736.3780-19-martin@omnibond.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181007232736.3780-1-martin@omnibond.com> References: <20181007232736.3780-1-martin@omnibond.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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