Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1725607ybl; Sun, 19 Jan 2020 09:38:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyI6ARdBpmmBLLqDjfn/JIHP45ajfxspOV1zZsXkdpU4RQqfBe6ai1UNJV7wyh86gbmfwp8 X-Received: by 2002:a05:6808:b37:: with SMTP id t23mr10585061oij.149.1579455483554; Sun, 19 Jan 2020 09:38:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579455483; cv=none; d=google.com; s=arc-20160816; b=A4HpH424eDlh6bHKNaqKRRGHy/Hu1AW1D//hseLLGdnkpsd33leDPO/pagyOtcHG4M fVnFSAzawUznh3Vk1+WwlZcp017Srsi0XrHXT/J4s+nvgwK2CL+AaL5WzmRUYmAz1Cff rLsYFZ5jmkQfo6e+GUyyRLFQJjOQg3NLgSmD9GuoGXxJzV1ftkaZQP2qKzJYnFBq9iw7 mBdBrU/V09WUzt1NDSEz8JnFHp9zTUkLD4INNaLSRSG/6XsRZ9sSdyhzU3ySNLD+JDri wgM8DQcXIBMiUyxNmER0OB3nkcaV/oiDgu5QuULlu6fMIZVK+fSfAzsPlhzU6QYXVG6e ILNg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=MjiDSm+kbE19Xsf89OAuKU7UGoGUkkLjZk/my0evpWk=; b=h7ERHtC/spq4BnB2uXTCVUeHRxv7JYbBg9ZTcQW/p8AlSGJgiYJTxn81WD5J6/Lu7+ meKYhBTuNXx/ZjztkSUsewZNYEpO1IYNDTr+NV5Gih0gTvVw3HAmDbNlkaie9xOlfODJ x1ECioUJGTsJ4XJmlyfibVjGWuNUDNofYUr+XCz4IyRDmhI3emHPTiMG1Ni+9qIjsjFb QQb+8PmqM1UykxaA5QC9pXQkePm8cU1ABUFrG+72t2unwrWS1SGlwW/gLVY2H/npkH9o fdpQXDIw+6eCa9QjFZCyUUpGc0aUZCPBrVYi1PLuoPiFrZwa7tEme/TaGrcic9a98c1t 6W+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=cNlNPyRC; 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 z22si5074422otq.94.2020.01.19.09.37.50; Sun, 19 Jan 2020 09:38:03 -0800 (PST) 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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=cNlNPyRC; 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 S1728640AbgASRgq (ORCPT + 99 others); Sun, 19 Jan 2020 12:36:46 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34628 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727144AbgASRgq (ORCPT ); Sun, 19 Jan 2020 12:36:46 -0500 Received: by mail-pl1-f194.google.com with SMTP id c9so6833121plo.1 for ; Sun, 19 Jan 2020 09:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=MjiDSm+kbE19Xsf89OAuKU7UGoGUkkLjZk/my0evpWk=; b=cNlNPyRCgj4snsn6mEzBHv5+oRF//axl/e8NwKG9UQL1LNcLt/0aY6YE4dA0pJEU26 fHMfk3EQzaFmr0Lbdm8Rb6tKLTgspttba5X4AbbgJIo/qVf5e/LjezjHW7s7N8dOdEAV UOh40bNTLLT0Q33p0em/+bFMhXeOzhnE90JUNM48AaS2zfRTfoEJJ/1CyBifFGntIxyC 2W2EyZyXD6bFPFBGMqHOFWLMf1BoQqQRTBmuRp/z8MqhbFRFzfpRyd3pXgNpGCtuS1mF c4aDy2AfeuU2Aehkptcr8NGQbGvFky/qKBvrdjOAg44kC3fKCgCLb+SdkbNe5wC68Ybw fC5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MjiDSm+kbE19Xsf89OAuKU7UGoGUkkLjZk/my0evpWk=; b=oNzrDwxNW1LlEwD8KqNp9s0w3HFZWCNh7c0hoTvUPATY/1lJNckbGKTLNiMKhtsKxZ 2ct0Y1HA1AyOdJMO5P2cKr3v0Tzh+IsWOSkUNor0nsIY3w8KWPPV75kCimzvCR9wNWx7 iYPJZAhzRj4qHo0AMWH3aTODv1SH7zZJMmktRCXqb6FRgfScntFomEHsh2TYgFTb2FJt yu/DtoAK1X741Uv0CLOahe0O2RZYv2t0OGJZWWsOyiWldm0Hdn79iNsxwP3opwFJ0Q99 5YBBnKI8bSV9SVzQ7tyjLUbrEDvdSxhSHlkWiDXpM6CK9VMI+hHJUC4mxEbiFctoHIPe 7OtQ== X-Gm-Message-State: APjAAAXFi6LsyY2zrNqzSApifP2KZDwf0I8LR+W7vR5/sWKzzx3HcvPm LTQNT31YUbJ+YEB3oFjMRZ/nuq+prRs= X-Received: by 2002:a17:902:8f8e:: with SMTP id z14mr11013035plo.195.1579455405303; Sun, 19 Jan 2020 09:36:45 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id i2sm34798703pgi.94.2020.01.19.09.36.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Jan 2020 09:36:44 -0800 (PST) Subject: Re: [PATCH v3 1/1] io_uring: optimise sqe-to-req flags translation To: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <648dbd08d8acb9c959acdd0fc76e8482d83635dd.1579368079.git.asml.silence@gmail.com> <7197ccc8-6fe2-3405-c88d-95bcb909d55a@kernel.dk> <8ce8fffb-f02c-8d0d-4b22-626742f1a852@gmail.com> From: Jens Axboe Message-ID: <7176fd92-9bb4-1017-2b8f-3deaefa41ddd@kernel.dk> Date: Sun, 19 Jan 2020 10:36:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <8ce8fffb-f02c-8d0d-4b22-626742f1a852@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/19/20 12:46 AM, Pavel Begunkov wrote: > On 18/01/2020 23:46, Jens Axboe wrote: >> On 1/18/20 10:22 AM, Pavel Begunkov wrote: >>> For each IOSQE_* flag there is a corresponding REQ_F_* flag. And there >>> is a repetitive pattern of their translation: >>> e.g. if (sqe->flags & SQE_FLAG*) req->flags |= REQ_F_FLAG* >>> >>> Use same numeric values/bits for them and copy instead of manual >>> handling. > > I wonder, why this isn't a common practice around the kernel. E.g. I'm > looking at iocb_flags() and kiocb_set_rw_flags(), and their one by one > flags copying is just wasteful. If I were to guess, I'd assume that it's due to continually adding flags one at the time. For the first flag, it's not a big deal. If you end up with a handful or more, it's clearly much better to have them occupy the same space and avoid lots of branches checking and setting matching flags. You should send in patches for IOCB flags. -- Jens Axboe