Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9657993ybl; Fri, 17 Jan 2020 16:20:11 -0800 (PST) X-Google-Smtp-Source: APXvYqziZWVUTuvhhMU3hwFKceC036WKkb/iRNP8VysuN3MdLRULeYolcB5dISN0AqYKUmmh3DFx X-Received: by 2002:a05:6830:1042:: with SMTP id b2mr8068536otp.306.1579306811715; Fri, 17 Jan 2020 16:20:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579306811; cv=none; d=google.com; s=arc-20160816; b=crP3/zMUHCvsjr7uugj3f7R6u3AclpiFEoBz4p4mdrUitBhXnhAQTz4fNf2qb0DIwR 6PtqAUk16CbikwjBJViRPo1kIWx9AtV6MyO15p8DM0b/w3Z0ht2lsqZGyTSpHqZHlwvQ vk+CSz86tRziP2SJ8P9h0TXdCJ/Myo41KCZyzamsWM7h47KAy/trhnCasmYTQLiQR56U Vr/hEma+VPkjJWts6liNpQ3RsE05qy+z1YbmPNOJ4JxzS/xni6NIbaNrEeUHCqkGt4CV 7qPdkTyLDUIZjwfTnRXAhkD8Q4nw0tHF69RfMiKY1E/obJmmZ43aPxtqPKRhDIMG4cRA Kinw== 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=Y6hFtlGWNj2335ptBmTRWPobE2rmTBdw86gaZCZvr98=; b=HxdPqZpm9Acd1F3SDFKAPYwbEDasrEbU6xt11nqlcQ4o9tHbfiZEKLIlF9boJrwI8q M5REgqbsLYX14xeaPNyQhHOVHoKopDMsn6f0pWiBq+x26hjjml8ODiVWE1eyRJ8RFZ2h y2ds9cvVnxrxajpUBEZ+2DzG+Q1/lbTOc0eyxvZo07tul6kCU9T758mcpwIbRxJhIjyE d9US/gT4N35PFb1RLoSlS6A7BatK6R3nX7ir1zCDFu9jLJatAoBHnlKxNG1dvQCpznm1 ohGmk/+fk5OljV2H7irDd6o4tijLN2NXQq6WkRTD+szk+aNq3mN652oWUT+pqnU1OSSM RjBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=piNWalyr; 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 r15si4391741otp.211.2020.01.17.16.19.51; Fri, 17 Jan 2020 16:20:11 -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=piNWalyr; 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 S1730415AbgARARA (ORCPT + 99 others); Fri, 17 Jan 2020 19:17:00 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36561 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730260AbgARARA (ORCPT ); Fri, 17 Jan 2020 19:17:00 -0500 Received: by mail-pf1-f193.google.com with SMTP id x184so12691341pfb.3 for ; Fri, 17 Jan 2020 16:17:00 -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=Y6hFtlGWNj2335ptBmTRWPobE2rmTBdw86gaZCZvr98=; b=piNWalyrCazeaNdOIEIExKlexZTPIGOgNqDRrIJZk+6RywU5zIJ4q2GRfg7Y6teOQy uwZfYEHYU5cpPTAaQIV9LDwHWphc7CB3f3Yb7ai8TvKyN5WRnoTsv3uXBPmYDHZKpTdU 2B+slw2na/O0P2Px0ooBbVj75eH3Yw6VPZqBxZsIWRs1uhtFArdeBxnuUc0GOlUVIVtl CQLsS0rwfaIjcA025vDbKYVrkkKckA06w4uad7Kotj9QSVEzFZcf8cyF9lryN+IOl73j ZSbTUyadOq4ClJBO0/gw4dbjk2DdPf2gWX/6DuQIMAHvvcHsfquav4FpPjBNBShRaI8g 5gkw== 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=Y6hFtlGWNj2335ptBmTRWPobE2rmTBdw86gaZCZvr98=; b=kV3FwVob00qfShuJB3+V/D6ReLYbb2C560Sl2Oke9mmiLLIDXuWjx7Cf9qhC7+CTIh txESq6Vj6NzZTYKWGeLPfitB2gK3sMX80WcbsEEbMFgvWQsXbNI85g01WylLB0GPzhSh xuJFFBb9mAXLpsCpskQTfUa+76ugDhi83siykEMnzaI+DYpcTZl+OshnXLgbuzIfk1pH odmD1jXXWJIAsiG6DaXtyeRzEBsw4AvIVbus34UyKm1qFIYS189eX/7b2tTv5vJh9Abh giC6EO/YQUJgvbdZd+SFs0TM3aDLJshlKr8OvsVNRTdBGim1sK5zRT/gz/E2em2Di5ML UbyQ== X-Gm-Message-State: APjAAAX9iNB/TmA/1PNGzl/0QajaVdth4Rfd4gA07L3lYRm9uNHrxU3t tRXurOG5GeNp1dNBMt2LMSDTU9XFizY= X-Received: by 2002:a65:4381:: with SMTP id m1mr49118391pgp.68.1579306619174; Fri, 17 Jan 2020 16:16:59 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id n26sm31102181pgd.46.2020.01.17.16.16.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Jan 2020 16:16:58 -0800 (PST) Subject: Re: [PATCH 0/2] optimise sqe-to-req flags To: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: <37a04c11e980f49cb17a4fd071d2d71a291a8fd5.1579299684.git.asml.silence@gmail.com> From: Jens Axboe Message-ID: Date: Fri, 17 Jan 2020 17:16:57 -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: 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/17/20 4:14 PM, Pavel Begunkov wrote: > On 18/01/2020 01:49, Jens Axboe wrote: >> On 1/17/20 3:41 PM, Pavel Begunkov wrote: >>> *lost the cover-letter, but here we go* >>> >>> The main idea is to optimise code like the following by directly >>> copying sqe flags: >>> >>> if (sqe_flags & IOSQE_IO_HARDLINK) >>> req->flags |= REQ_F_HARDLINK; >>> >>> The first patch is a minor cleanup, and the second one do the >>> trick. No functional changes. >>> >>> The other thing to consider is whether to use such flags as >>> REQ_F_LINK = IOSQE_IO_LINK, or directly use IOSQE_IO_LINK instead. >> >> I think we should keep the names separate. I think it looks fine, though >> I do wish that we could just have both in an enum and not have to do >> weird naming. We sometimes do: >> >> enum { >> __REQ_F_FOO >> }; >> >> #define REQ_F_FOO (1U << __REQ_F_FOO) >> > > I thought it will be too bulky as it needs retyping the same name many > times. Though, it solves numbering problem and is less error-prone > indeed. Let me to play with it a bit. It's less error prone once the change is done, though the change will be bigger. I think that's the right tradeoff. > BTW, there is another issue from development perspective -- it's > harder to find from where a flag is came. E.g. search for REQ_F_FOO > won't give you a place, where it was set. SQE_INHERITED_FLAGS is close > in the code to its usage exactly > for this reason. Since it's just that one spot, add a comment with the flag names or get rid of the SQE_INHERITED_FLAGS define. That'll make it easy to find. >> and with that we could have things Just Work in terms of numbering, if >> we keep the overlapped values at the start. Would need IOSQE_* to also >> use an enum, ala: >> >> enum { >> __IOSQE_FIXED_FILE, >> __IOSQE_IO_DRAIN, >> ... >> }; >> > > I tried to not modify the userspace header. Wouldn't it be better to > add _BIT postfix instead of the underscores? No strong preference, I usually do the underscores, but not a big deal to me. There's also BIT_* helpers to make the masks, we should use those. -- Jens Axboe