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;