From patchwork Tue Sep 11 10:11:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10595409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC0C3920 for ; Tue, 11 Sep 2018 10:12:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C972D29199 for ; Tue, 11 Sep 2018 10:12:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDC0E291B2; Tue, 11 Sep 2018 10:12:25 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 518D829199 for ; Tue, 11 Sep 2018 10:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727578AbeIKPKz (ORCPT ); Tue, 11 Sep 2018 11:10:55 -0400 Received: from mail-eopbgr70131.outbound.protection.outlook.com ([40.107.7.131]:22448 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726559AbeIKPKz (ORCPT ); Tue, 11 Sep 2018 11:10:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9Cm/aDBz3hNxAAUv9j8pJbdD2t8s/8zLQKnQa/Vb33U=; b=W4Tqi0A87Md99Th7k+CsITBNZl29NwaNdKG18iLFKTs+mlz9JK9vMzdR+86kMpxU2+8KxtokaO0mWJd68lUbWWZDD/PESF7W8/94iP2WfFVRFrQeSP+73dJCsCSK5G9NszfW2qLP+sjqWpeYQV8tR6RV6+tUr6y86X9O5Ze0jwo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by AM5PR0801MB2019.eurprd08.prod.outlook.com (2603:10a6:203:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.17; Tue, 11 Sep 2018 10:11:59 +0000 Subject: [PATCH 1/3] fuse: Change interrupt requests allocation algorhythm From: Kirill Tkhai To: miklos@szeredi.hu, kuznet@virtuozzo.com, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 11 Sep 2018 13:11:56 +0300 Message-ID: <153666071673.19117.1104907275035187545.stgit@localhost.localdomain> In-Reply-To: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> References: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P193CA0021.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::31) To AM5PR0801MB2019.eurprd08.prod.outlook.com (2603:10a6:203:4b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6044afe-020e-4208-643b-08d617cf0352 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM5PR0801MB2019; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2019;3:FG9NN48I5K3+js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PJYlo/HYp+DxJ7AjvuqE/or+c3z7gvwAlv6N6iy8jegfEq9YH6kITVp7z4sCN9szXAC0oGGQzC2SQfMOkoD8g6wJXqIZdTQXVUJ34Osx6brkqFtPdrtERZ6uIrDilGdXc9A4nv8yl6L1yo5f4BklHSUCdi3v3fMBfydIn/yN0qTBT1HxMn9wfaJs04zQ2YdELYbxtJpKbqqsJIN0NO1F8MT0KpTxt56dKmjy06kGGbow/A3GDjEKSugqZe5bHdrxZ67UZEEc9MB+fyJu6Qc3r+5NoTegvvo7/Thl7M3C2jGZVbn95kiuuvxU4HrLybRUUadTtQsb+f7KdhbaY6RlhUA3HKrNhKpCYZY4Davl8TI/m7v+RimSKzrxGn;4:Uw4mydoJ2lDMQPKcDkszI3EM6Zjtu7IuyZ+LczCnGx4mMky4MF4KnnRymcOCFth+xWwCalGpm2STsKQ9MGkVBppesj/6yn00peanUu5OkqZK2WqBcCmImsqsScYAh9OeJvVVdWeqAH+h3/nTo8fSxDgQFKkAwusRYmyBl/OR4HU0MyWIO1yMe3OWLwTd+w/n/C4bm0DGGYyKoBXATxWTYo+2H3AyV+SAeuiPVc1NX/KOvZpBRGIdhvqbKnBLSUzLJl6HRvF2YYDnDrIIVpGIIg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(823301075)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699050);SRVR:AM5PR0801MB2019;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB2019; X-Forefront-PRVS: 0792DBEAD0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(376002)(136003)(346002)(366004)(39850400004)(396003)(189003)(199004)(97736004)(47776003)(61506002)(14444005)(478600001)(58126008)(66066001)(230700001)(956004)(11346002)(5660300001)(53936002)(7736002)(446003)(305945005)(6116002)(8676002)(105586002)(316002)(3846002)(106356001)(103116003)(68736007)(186003)(16526019)(2906002)(7696005)(486006)(76176011)(23676004)(2486003)(6666003)(52116002)(8936002)(476003)(50466002)(9686003)(33896004)(26005)(386003)(6506007)(81156014)(25786009)(81166006)(55016002)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB2019;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BAM5PR0801MB2019=3B23=3ATIoo8?= =?utf-8?q?K3MuSjlaUQLEnyp6DESqUmkbCDgivlH+OpjNin5JZ9BjIeUBhqy2N0dPMBxbx08p9?= =?utf-8?q?Lgwqrl14rDi1PPwxciSMaON6+lOd4bo480arX8Ox2xPfN0CyKyVdDrnf2Ymq40PDR?= =?utf-8?q?FMW4IAhkNSAgMxb9/tAqT5L8XUKD7xi3I12jFuTZMkqQ97Ee3VLqmTFcVutEUjV49?= =?utf-8?q?6RmyexyapYVRXWJo6jJ1XPOkOGGsG1UVEBzmcdLLJPYaZgYRckvstoSERx9+DiDRw?= =?utf-8?q?cSHnQPcKGGy67SGwjQZNmofppW0MGxCF3nL+fgtY7pKGwuHPgELfbdTWDdmBR3JYr?= =?utf-8?q?S79ajLRKSthXFWfLOs6Gb5LKiD8FAKEIDtu9AJvcnWsa7PVUQG/jG7qOfjwbdrLRG?= =?utf-8?q?pgYWFTth5wbB/+XvHbeSAt86B0z0apYL9jutJJoAeT2Sscxo5b9TtfrQq2uEgEJlM?= =?utf-8?q?bD9bpwb1PPaNDqTsPWu3Tg5ADrV+EtpIT8QV65js1MR1HunJzX1ov51khhPth6iGf?= =?utf-8?q?Aqyi0q/UqCHm4EYpU30fU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Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2019;20:nmReKeyyVN8q2O1A5itAr98VE8E5g2ZBxTJyFYHGvy09/SjZwoD9ovEjt0G/29VGEo410PFoVfe48W5L58G+j3vEEHZWunNbbgWdpIBhJG28/flWqj8oVaJ3BLFNQcomO93Suv8kfk387GwYRsUaD0J4Crc0kH1Cs7LH70Pgsrs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 10:11:59.5499 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a6044afe-020e-4208-643b-08d617cf0352 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2019 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 Using of two unconnected IDs req->in.h.unique and req->intr_unique does not allow to link requests to a hash table. We need can't use none of them as a key to calculate hash. This patch changes the algorhythm of allocation of IDs for a request. Plain requests obtain even ID, while interrupt requests are encoded in the low bit. So, in next patches we will be able to use the rest of ID bits to caculate hash, and the hash will be the same for plain and interrupt requests. Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 11ea2c4a38ab..f24fd6f61a7a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -25,6 +25,10 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); MODULE_ALIAS("devname:fuse"); +/* Ordinary requests have even IDs, while interrupts IDs are odd */ +#define FUSE_INT_REQ_BIT (1ULL << 0) +#define FUSE_REQ_ID_STEP (1ULL << 1) + static struct kmem_cache *fuse_req_cachep; static struct fuse_dev *fuse_get_dev(struct file *file) @@ -319,7 +323,8 @@ static unsigned len_args(unsigned numargs, struct fuse_arg *args) static u64 fuse_get_unique(struct fuse_iqueue *fiq) { - return ++fiq->reqctr; + fiq->reqctr += FUSE_REQ_ID_STEP; + return fiq->reqctr; } static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req) @@ -1084,7 +1089,7 @@ __releases(fiq->waitq.lock) int err; list_del_init(&req->intr_entry); - req->intr_unique = fuse_get_unique(fiq); + req->intr_unique = (req->in.h.unique | FUSE_INT_REQ_BIT); memset(&ih, 0, sizeof(ih)); memset(&arg, 0, sizeof(arg)); ih.len = reqsize; From patchwork Tue Sep 11 10:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10595407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ABC0E920 for ; Tue, 11 Sep 2018 10:12:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9922729013 for ; Tue, 11 Sep 2018 10:12:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AF10291AB; Tue, 11 Sep 2018 10:12:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 19E6F29013 for ; Tue, 11 Sep 2018 10:12:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726850AbeIKPKv (ORCPT ); Tue, 11 Sep 2018 11:10:51 -0400 Received: from mail-eopbgr70105.outbound.protection.outlook.com ([40.107.7.105]:46825 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726782AbeIKPKv (ORCPT ); Tue, 11 Sep 2018 11:10:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cGVQ7LONaJYkv88zRz+vowQruY6FmjG6LNj61+EkXsE=; b=erHlcuGMZyEArRB7cNDOeKkn5zoixArlmk42ZaSP7Y7zcNUTaYkVFCj2MR5X6LAcy+ybh9CR5VbvZTMNmw7ED2Ziwt95AUjBSPSQaR4SR4aKq5RhINdOnzKpuQFAkMMhh/j0b6oXhqK74jptOC0NRXIlrwQMe5AKFvdgXQUMP2k= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.15; Tue, 11 Sep 2018 10:12:08 +0000 Subject: [PATCH 2/3] fuse: Kill fuse_req::intr_unique From: Kirill Tkhai To: miklos@szeredi.hu, kuznet@virtuozzo.com, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 11 Sep 2018 13:12:05 +0300 Message-ID: <153666072546.19117.8470733578671949444.stgit@localhost.localdomain> In-Reply-To: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> References: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR0501CA0048.eurprd05.prod.outlook.com (2603:10a6:800:60::34) To DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44b25356-abe0-446a-aac5-08d617cf08c0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB2021; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;3:j/ipjxIzFU0Amb0YaORR3BXefo+GAXGIzJPOWisCY90hFAVxb00EfRre7JW65Lyvwm5KlDtv/5tGRTc53GGRvXhYIs+tXj1/rts24OlDc0Oba4raYBLtAdYU9shcka9s8rgJ+yC87nRaOOY0RqNl3BtJ+XkSR6w83kpLoFz39Rqz7M1bEhDsltwE6O+m0XtuJeHbk9A5mDc6mbZO4IjlKPfLn9QFucKdsytnch0/iq3qb5U6w1bDgxv8d2kqj0vJ;25:hxepqkvg2Hx4sHp3C0u0jb0VXdaVcQn+2V/FHdMpMSuq8YUDiZWOoddD0+1RhyqLTQc6QOnM0eR2iTOL55dhdF6D3S11H47pNf8WR+pzyrqqs/FwIzmaBsHHCzgJa2xYxMMK6VK3qFSnUmJboyClZ/0w5SYkXOXpbCwkQMlI4ezU14QT+80rO2F7TJ9YtpCxCCpoZrWlF70gi8+HymcHr1dGvClAGUizo+8XrXZAU/AfgH/La/fzTIqe9kfoBVa/khNSJtLtjuqLCahM4sTwBcRJsJ3yn4FJJzm432wKHkT3L3f4gz0EVLk8TGUvHZ2DfXpgRY5q7YICZXfhvaNYlA==;31:kkkUohcs9fN18CyDALY+mfWoY65TzsnX3Zvt9KDdX3X8swECTF69tlt1yWCdNq1dgO785sW359117q0DhwUDWICCeJdHOmcb2e6i0GFU2xSsuP3dX3N9C1UWhRc2m1QqtX2TEWXfv+X0tPbQxQTDGXECNzdUk/A5lMaFUdD1G3X39i3R9O6dChwC65XGZrfVaB3trS5VlSQT9t7A6wTSGar/maR6nHQl8/+uGNR+n9Q= X-MS-TrafficTypeDiagnostic: DB6PR0801MB2021: X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:+kpys9YuTDOQAUuRhWP1otmu/GSfpXMMtXq/4P8220UW1MAsGiHojHXhUtb465IyjsjOt/tAmM7k73BCQdHhkAfT+9dTbDzGqLKaV6SIuXxlBP9S4jRHxIL36gyzmv9ZaOOl9XLgR0CFw6pqLYec+f6x8QwyckkdBaib/2P61Pz8p4WWKyj9m4p5bfHt29zD+d7ZvHca3DWjynUvtqj2JxSrl5UeBUoSv6/sSY7Ps9Ujyzky8e2MIz5u7g89p+5C8xZ8MY9HFhm+SUcgOaXB5AwdY248F1TOxS+oNaZ2K1+gMe2i52nmLY+8TZQWbnX3g7uOsE1tKU6pCkptsHQOyk6p61K7z1nyfvUUEjxLldsfmOUS8xwv4FBO/PGHZadQRM8u6spyhHf+qEHMJfFaveaJzQ4wgGuEoBeW2msJOrqRqgwUIoeJqpqXqgV7QY7uDp89/9n3cpXmZhQAkIj3IbDmDFxD1fKYPc8PMwkJvh1TLfshlDPZ4alMWJ5nveFw;4:GCs+1nNs2Bnm2EohxjgchcA6CO0SgTQmhJOFeRAQz4r3ZY+cNL5WijhRWTfCmBYLqYFpbILgjBaSNQaYUFtdM+NsfnfxpYypdPqEkCZcklpz/RtpBOhvOCehrTXcthDgklqv6YgOivxBu+TFaaMoQK+2AU1YOl8Woad69oFibdpFrJzWacI4Ye5FJAMd7BkYKwrSG4iA9prCN01xeV9dkju6mv5EjiNfmb/7OGyY74IhLFE/SN+G/ceXYEZCJYhhQUIDNLf/0xywTi9jLuP6Qg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(823301075)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(201708071742011)(7699050);SRVR:DB6PR0801MB2021;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2021; X-Forefront-PRVS: 0792DBEAD0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(396003)(39850400004)(346002)(136003)(376002)(366004)(189003)(199004)(14444005)(33896004)(86362001)(47776003)(230700001)(66066001)(61506002)(478600001)(53936002)(486006)(81166006)(81156014)(76176011)(446003)(7696005)(11346002)(8936002)(386003)(97736004)(6506007)(26005)(476003)(956004)(58126008)(23676004)(186003)(2486003)(52116002)(316002)(16526019)(2906002)(106356001)(105586002)(68736007)(7736002)(50466002)(103116003)(5660300001)(9686003)(55016002)(8676002)(6116002)(3846002)(25786009)(6666003)(305945005);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2021;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDB6PR0801MB2021=3B23=3A5hwda?= =?utf-8?q?wSfaA0J7eriOmNuFZq4tBjo4pUf6HF4Po40RgoZ5zPPGsQXMHk0mjdq96Uhi1rMlw?= =?utf-8?q?JUoVYkFolV5C7WAIwjIPo3dogklMJvali6eXfJlcKk2vqCFjQboJAKG5BEAoBkUIX?= =?utf-8?q?s8CGlu9ftbNX8fk2zzCLqNnuwxPSgynW7vU7HoMJTQTMnCBZOtrpyKKepMd9mGvFa?= =?utf-8?q?B+MU9ZomxXH6SBv8dgK0/B0sccohzNMTmyWDbpoB39/ylr+5zcgYDpFpx63/duWex?= =?utf-8?q?pzsBj5oq+2dIxLn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IPawo=;7:3AeLSmbgd2Up9tvHpUbaxNFVJftVtm8AOfr5Qs+pW4UBKQDoqsz/x0s3sQByJ1a1HjuUHV33dSmFMf/b4QcJ1C9sWVJrNv6VrDETia6VlcWG9nydAoYzEgJPfm/fEcSR9fJr+guqLtZI1komgpmZlZivyZrPjdsBI97ucvxJPfEM+y9/jpfVL7UjLu2qmcjSPkrW1gdpbmtFIdebK/L0LhDlfzeqVXvMyiSk4E2PUS1LuUQcX5GLO9ZeRK01hakK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:SvyE8MslvFGK7fX9ZNVg/ngGW6UkBOcM8rKaXeXd68n/lvRJM3Y4UM19yMNY5HParVPTglj//t0RlxnjLMqdijmQ5hZu5oG4M1mv63dvJzqTV/SOX8c1BvqiKEZvA5L7hI1FFgAQAdMg3sSKZbWV1MHItM40T36xHZS9jFo7d4Q= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 10:12:08.5672 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44b25356-abe0-446a-aac5-08d617cf08c0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2021 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 This field is not needed after the previous patch, since we can easily convert request ID to interrupt request ID and vice versa. Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 11 ++++++----- fs/fuse/fuse_i.h | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f24fd6f61a7a..dda177b57ea2 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1089,12 +1089,11 @@ __releases(fiq->waitq.lock) int err; list_del_init(&req->intr_entry); - req->intr_unique = (req->in.h.unique | FUSE_INT_REQ_BIT); memset(&ih, 0, sizeof(ih)); memset(&arg, 0, sizeof(arg)); ih.len = reqsize; ih.opcode = FUSE_INTERRUPT; - ih.unique = req->intr_unique; + ih.unique = (req->in.h.unique | FUSE_INT_REQ_BIT); arg.unique = req->in.h.unique; spin_unlock(&fiq->waitq.lock); @@ -1799,8 +1798,10 @@ static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) { struct fuse_req *req; + unique &= ~FUSE_INT_REQ_BIT; + list_for_each_entry(req, &fpq->processing, list) { - if (req->in.h.unique == unique || req->intr_unique == unique) + if (req->in.h.unique == unique) return req; } return NULL; @@ -1878,8 +1879,8 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, if (!req) goto err_unlock_pq; - /* Is it an interrupt reply? */ - if (req->intr_unique == oh.unique) { + /* Is it an interrupt reply ID? */ + if (oh.unique & FUSE_INT_REQ_BIT) { spin_unlock(&fpq->lock); err = -EINVAL; diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f78e9614bb5f..f72e4974b3bb 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -311,9 +311,6 @@ struct fuse_req { /** refcount */ refcount_t count; - /** Unique ID for the interrupt request */ - u64 intr_unique; - /* Request flags, updated with test/set/clear_bit() */ unsigned long flags; From patchwork Tue Sep 11 10:12:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10595413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 785B61575 for ; Tue, 11 Sep 2018 10:12:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66131291AB for ; Tue, 11 Sep 2018 10:12:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A1C0291B6; Tue, 11 Sep 2018 10:12:36 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 B72B5291AB for ; Tue, 11 Sep 2018 10:12:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727647AbeIKPLF (ORCPT ); Tue, 11 Sep 2018 11:11:05 -0400 Received: from mail-ve1eur01on0112.outbound.protection.outlook.com ([104.47.1.112]:40416 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726559AbeIKPLF (ORCPT ); Tue, 11 Sep 2018 11:11:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OUDrMj2YxatT8kZQG8JHcY6CQX7U3Z00A4nVD06wGGI=; b=QYJLYdxVkuhhGwV6whidn/s7x27RwJe/K5yN4T8D4xPT6sFEH692l7i1HfugVkZGNR5QsZSwBGpvDVOnCpX7ftJFHkeLPAdrDn/Vm+is7u56Gz28LNoryC3171jJPduZmVxQpYe/ijpYnNov6PSut9IP56mHDzBuefYCjXvuu+c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by AM5PR0801MB2017.eurprd08.prod.outlook.com (2603:10a6:203:4b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.17; Tue, 11 Sep 2018 10:12:18 +0000 Subject: [PATCH 3/3] fuse: Use hash table to link processing request From: Kirill Tkhai To: miklos@szeredi.hu, kuznet@virtuozzo.com, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 11 Sep 2018 13:12:14 +0300 Message-ID: <153666073461.19117.1958730317836145457.stgit@localhost.localdomain> In-Reply-To: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> References: <153666041612.19117.14667042009014596105.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR05CA0155.eurprd05.prod.outlook.com (2603:10a6:7:28::42) To AM5PR0801MB2017.eurprd08.prod.outlook.com (2603:10a6:203:4b::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22d944d2-a857-4b4c-aa0b-08d617cf0ee2 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM5PR0801MB2017; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2017;3:59/XzLUc9dT+d2r2Zy/yQ6aBYw0puY0U1nBQWWDh+011XUOPLLcZHNhJov/BP9AcT6XhmInLiKYNCCapsWIaAXRDOkwzVFkZcIMBrHRQLq9C8R9GOqcQBgr/G9m/Kbc1DHwSizGSq2P//bFlAdVGh/ZdWp2nVe7EOeChY7Ebe5/ZYaoaIo9LdslLmIWhWnLSXDz761pmWUSXkriksWaSH3VyqONv1LM4KvrtXi5GSBAi+3VpQ9S1Mi+8f6hQ594l;25:yEsI2Fivyr6oJgYyeINdG/RiDtbTZ3e33CnMOUSq2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EL4yf3fbL9u88FTQdRYXrL4GEfjxbFNCPUVkUb2FifNEPTGiw4S4OaIuMJ/myXclFsWfSZ1jZAosGJDqnej5xFXfzhEEc1GqpZdzT;4:5KqFG76guGC5bnm3am+G82cTASG1QQYXGstEtnewEpd+7oSMTli3fUhg1GGdUs+5ESSFy5Vu6F9jjRA5Ps3vCLkBrh8wrPc9GMuCzh9HTm+LrTaVtohTA6779/xaT3QM7qKa7skCmRasnmzUkmY5BlnWQ7Ef6Uy6AUT2FXuxKArKatMndhz6+7FIzsoy3PZvx14ZWdmmyYVe+c47w6efN4sfJ8FyxbEfEEl2PDv6m3jFGzcNtFFbIP1S4FkeQnt50wSH/Lq7PFna5cPo67YSA1zaDo5YzSRx+1ICF6e/LQFKyuJe9kit57cFDm0wqioz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(190756311086443); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(823301075)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201708071742011)(7699050);SRVR:AM5PR0801MB2017;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB2017; X-Forefront-PRVS: 0792DBEAD0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(396003)(346002)(136003)(376002)(39850400004)(366004)(189003)(199004)(106356001)(2486003)(103116003)(105586002)(50466002)(186003)(16526019)(52116002)(26005)(23676004)(6506007)(386003)(7696005)(33896004)(76176011)(478600001)(2906002)(58126008)(14444005)(230700001)(7736002)(25786009)(8936002)(305945005)(8676002)(68736007)(81166006)(81156014)(476003)(97736004)(3846002)(6116002)(9686003)(6666003)(55016002)(53936002)(316002)(5660300001)(486006)(61506002)(446003)(86362001)(956004)(47776003)(66066001)(11346002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB2017;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BAM5PR0801MB2017=3B23=3A+NULm?= =?utf-8?q?0rjmx8drkVH94ghFSTcqXgaWcxWF8G1N+P3ZSPOtNQ0TxtobQJbIyjWHCoGvaOmf+?= =?utf-8?q?QFrPaPON3irnqlVM9X3x3cG6ETYAW6h4RjbHsUx42+fzQgtjnuzTCu5qg4ktGdoD3?= =?utf-8?q?AQERfjS2cwbY8NeEh/rSlTod9+x8feQ73CBpQ9/DkFu5Q+MX0BGuRwBT36rox94Xb?= =?utf-8?q?OKGu9s0R4lRVnXu9W2Y80dKq5l1LX//qvlVk4bXfI0MbJUuhQuZTqNBQfj/aXneev?= =?utf-8?q?IefKiX1z662SIQSlNtaDh8qC2+MgnQbBqReYPwhIOV14PDjSDh972STTN5J+1ne0V?= =?utf-8?q?G2jVGQ7T1Uekgj8aE1APHIKiyZUhJBjM14+dM7Hwzx5LS4xfMl3wNGr+q7Gw3vE5k?= =?utf-8?q?K44xkg9C/06K8+V3T97EElECoGVbDsUxNc2/1T74vHG65bBPjMYcQlqVbgKTaQ7B3?= =?utf-8?q?DlH6BMoFYe8aUXIIT3hO0UejepQEhJtjQYHLtJosFTGM0xEvKdVFk8JweqvSQcPNd?= =?utf-8?q?+oEmpylQzfCMksCIlND2t+F/T9mC0udhTOk6ooBlz6HBoOmUjwypR6HEVqWMkOI3W?= =?utf-8?q?LwTFHLch8whZcpfKdApsFW6tEyKb4xiyzN6nlQDgVUJiaya0R3/0e4lJ+5d5ujnBb?= =?utf-8?q?K9uw3b81xl/aO/3CtDDH5bB2U1WjoJCK6iymrBZRII3mIbjXbWcFgooXRE2Rz8ntg?= =?utf-8?q?GivZ/f685dDj9qVA5g7ZhXPzh6Bm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MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 10:12:18.9595 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22d944d2-a857-4b4c-aa0b-08d617cf0ee2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2017 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 We noticed the performance bottle neck in FUSE running our Virtuozzo storage over rdma. On some types of workload we observe 20% of times pent in request_find() in profiler. This function is iterating over long requests list, and it scales bad. The patch introduces hash table to reduce the number of iterations, we do in this function. Hash generating algorithm is taken from hash_add() function, while 512 lines table is used to store pending requests. This fixes problem and improves the performance. Reported-by: Alexey Kuznetsov Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 29 +++++++++++++++++++++++++---- fs/fuse/fuse_i.h | 8 +++++--- fs/fuse/inode.c | 5 ++++- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index dda177b57ea2..867825cd04fa 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -327,6 +327,20 @@ static u64 fuse_get_unique(struct fuse_iqueue *fiq) return fiq->reqctr; } +static unsigned int __fuse_req_hash(u64 unique) +{ + unique &= ~FUSE_INT_REQ_BIT; + + /* Borrowed from hash_add() */ + return hash_min(unique, + HASH_BITS(((struct fuse_pqueue *)0)->processing)); +} + +static unsigned int fuse_req_hash(struct fuse_req *req) +{ + return __fuse_req_hash(req->in.h.unique); +} + static void queue_request(struct fuse_iqueue *fiq, struct fuse_req *req) { req->in.h.len = sizeof(struct fuse_in_header) + @@ -1314,7 +1328,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, err = reqsize; goto out_end; } - list_move_tail(&req->list, &fpq->processing); + list_move_tail(&req->list, &fpq->processing[fuse_req_hash(req)]); spin_unlock(&fpq->lock); set_bit(FR_SENT, &req->flags); /* matches barrier in request_wait_answer() */ @@ -1797,10 +1811,12 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, static struct fuse_req *request_find(struct fuse_pqueue *fpq, u64 unique) { struct fuse_req *req; + unsigned int hash; unique &= ~FUSE_INT_REQ_BIT; + hash = __fuse_req_hash(unique); - list_for_each_entry(req, &fpq->processing, list) { + list_for_each_entry(req, &fpq->processing[hash], list) { if (req->in.h.unique == unique) return req; } @@ -2108,6 +2124,7 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) struct fuse_dev *fud; struct fuse_req *req, *next; LIST_HEAD(to_end); + int i; fc->connected = 0; fc->blocked = 0; @@ -2129,7 +2146,9 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) } spin_unlock(&req->waitq.lock); } - list_splice_tail_init(&fpq->processing, &to_end); + for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) + list_splice_tail_init(&fpq->processing[i], + &to_end); spin_unlock(&fpq->lock); } fc->max_background = UINT_MAX; @@ -2169,10 +2188,12 @@ int fuse_dev_release(struct inode *inode, struct file *file) struct fuse_conn *fc = fud->fc; struct fuse_pqueue *fpq = &fud->pq; LIST_HEAD(to_end); + int i; spin_lock(&fpq->lock); WARN_ON(!list_empty(&fpq->io)); - list_splice_init(&fpq->processing, &to_end); + for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) + list_splice_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); end_requests(fc, &to_end); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f72e4974b3bb..ed69e1530216 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -408,6 +408,8 @@ struct fuse_iqueue { struct fasync_struct *fasync; }; +#define FUSE_PQ_HASH_SIZE 512 + struct fuse_pqueue { /** Connection established */ unsigned connected; @@ -415,11 +417,11 @@ struct fuse_pqueue { /** Lock protecting accessess to members of this structure */ spinlock_t lock; - /** The list of requests being processed */ - struct list_head processing; - /** The list of requests under I/O */ struct list_head io; + + /** The lists of requests being processed */ + struct list_head processing[FUSE_PQ_HASH_SIZE]; }; /** diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index db9e60b7eb69..b28412e75c18 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -594,9 +594,12 @@ static void fuse_iqueue_init(struct fuse_iqueue *fiq) static void fuse_pqueue_init(struct fuse_pqueue *fpq) { + int i; + memset(fpq, 0, sizeof(struct fuse_pqueue)); spin_lock_init(&fpq->lock); - INIT_LIST_HEAD(&fpq->processing); + for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) + INIT_LIST_HEAD(&fpq->processing[i]); INIT_LIST_HEAD(&fpq->io); fpq->connected = 1; }