From patchwork Mon Dec 12 18:15:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Shishkin X-Patchwork-Id: 9471013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E55B960476 for ; Mon, 12 Dec 2016 18:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D760527F85 for ; Mon, 12 Dec 2016 18:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBFA4284E7; Mon, 12 Dec 2016 18:18:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E10D27F85 for ; Mon, 12 Dec 2016 18:18:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380AbcLLSSd (ORCPT ); Mon, 12 Dec 2016 13:18:33 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33558 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752259AbcLLSSb (ORCPT ); Mon, 12 Dec 2016 13:18:31 -0500 Received: by mail-wm0-f68.google.com with SMTP id u144so12937694wmu.0 for ; Mon, 12 Dec 2016 10:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=omaXlMy58CFTeTrMKLjjfFNvx/CiqJN0mnbXN+lK3KE=; b=kR8uTUe8vrfHp2VD9D7MjLs+I0Jblus7jcp5fcNqLztrvW/AHiqAd2kzVZ1ddC1UFf w3KgOOyJTl2hvQIKoK6rU5DYYQoIxnVkoMlY0qoRf8R2bBNLH0FO+owS3Swonlvaywky ru7/DlLeadmEnr7aR8bP4Em4fDQDVvYljhG20UJRmbdD793U61qTYOd/Io4ROYuoN1y8 T59OBuLVdzjsvfuUP0l6wZSvVYS4bPPbkOB4TgDnGSZ8VEnu+6rg4lC8s3UCDxg+dcmI SefwSWsJ8lh5pmb4nT8laJ3/BGoEtOhDjEceKADk2yX6zFfcHyjYH5KJzBFF9PfhX4kz 7nPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=omaXlMy58CFTeTrMKLjjfFNvx/CiqJN0mnbXN+lK3KE=; b=Y3jTOwLdyM8axDaj6tdFwHZb+wssw1KDKjEbA+lM7XUE+vTPuqOPgo/bryvKZxdMNy AanJ89E0FkL+x92DXTu9u5jJ0yhkSenzNoywRZG8DvNYyHUk3LXE02lgfH8llu4pV/eC E/STImqcWJkDY2E7cL7LDYtXsjuJjxvpg2qz5RX5od/irrX/oMtdNwBPzm5VueLxAZOJ iMkbK9RsasvVqDg2K7dQZoZybrrGF5uUSRl1NLgiAPc8enVKMR/YDApLDJa5PeXTNron Iu2m5/UNU/VUXiTBisqPCj3oql7Q/YysR0+xfUJBuSonwimJP0Nn7uvrwxgyjWmKLYbm IrwA== X-Gm-Message-State: AKaTC01Zw6CNuhE4OA64TCs3bFZLGlIsWKzVG7pCMeb6FJ4aMv2U93fuVCzXwVfxFPLkYA== X-Received: by 10.28.27.208 with SMTP id b199mr18091044wmb.82.1481566710343; Mon, 12 Dec 2016 10:18:30 -0800 (PST) Received: from zeta.huawei.com (h-213.61.75.66.host.de.colt.net. [213.61.75.66]) by smtp.gmail.com with ESMTPSA id kp5sm58432667wjb.8.2016.12.12.10.18.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 10:18:29 -0800 (PST) From: edward.shishkin@gmail.com To: Eric Van Hensbergen , V9FS Developers Mailing List , Linux Filesystem Development List Cc: QEMU Developers Mailing List , ZhangWei , Claudio Fontana , Greg Kurz , Alexander Graf , Eduard Shishkin Subject: [PATCH 7/7] 9p: v9fs fix calculation of max number of merged pages Date: Mon, 12 Dec 2016 19:15:42 +0100 Message-Id: <1481566542-25894-7-git-send-email-edward.shishkin@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481566542-25894-1-git-send-email-edward.shishkin@gmail.com> References: <1481566542-25894-1-git-send-email-edward.shishkin@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eduard Shishkin Don't merge too many pages when composing a 9p message because: . it doesn't lead to essential performance improvement; . to not allow user space to allocate big amount of kernel memory. We use a limit of 256K (for total size of all pages merged per message), as larger values don't provide any visible speedup. Signed-off-by: Eduard Shishkin --- fs/9p/v9fs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 58bff9e..50a4034 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -319,6 +319,8 @@ void put_flush_set(struct v9fs_flush_set *fset) kfree(fset); } +#define MAX_FLUSH_DATA_SIZE (262144) + /** * Allocate and initalize flush set * Pre-conditions: valid msize is set @@ -333,6 +335,11 @@ int alloc_init_flush_set(struct v9fs_session_info *v9ses) if (num_pages < 2) /* speedup impossible */ return 0; + if (num_pages > (MAX_FLUSH_DATA_SIZE >> PAGE_SHIFT)) + /* + * no performance gain with larger values + */ + num_pages = MAX_FLUSH_DATA_SIZE >> PAGE_SHIFT; fset = kzalloc(sizeof(*fset), GFP_KERNEL); if (!fset) goto error;