Received: by 2002:ab2:5d18:0:b0:1ef:7a0f:c32d with SMTP id j24csp147809lqk; Sat, 9 Mar 2024 04:31:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZeA9UAvca37FBTUjtvZ7v2cWovn6rqhRT2jnqyLG5i5099371di8UEOl4sJYoqUhNvRLrIDZi3yxIFW8R+6dTG1ARCO522NfAg5lcUA== X-Google-Smtp-Source: AGHT+IHH3B4gIGPfSx4qAHFy1mvOQEUJ2IOvUFJGYsoobzDuPafihKVP6+BG91gO8WsKQFT8/HyN X-Received: by 2002:a05:6870:240d:b0:220:bbcf:1bfc with SMTP id n13-20020a056870240d00b00220bbcf1bfcmr1827756oap.12.1709987474266; Sat, 09 Mar 2024 04:31:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709987474; cv=pass; d=google.com; s=arc-20160816; b=WfsUK78xp/H1hZwCVU9DH91BuANRfV/eC7FpspkGif8MEw6RRQ1kgBjnHfkUA5bfa1 rJQhaifwVSPjnlpP2VkMtyneLrUXbJhVv7HmOwsr/hz+pDvrh13C0TfcHok+xJqPNUJH UepaG2nt1Fwlv60nVI5iJ86snFYgEreop/PkTzSP4Ax3X7CWUDSsNOQaikW1AFMw4cC7 6xhTjNIezSKfpz+pO0zyMfxMH2Mjww6BeMhB4WO9euNqqmTl9wUQBOZ1WIuqVhp7oAh6 aBnino55nef03PZ1cfa+9uKGJ3u8U9L9ad+euP8ePCQZQvxV1CUROXkNR+A04gqeg/bu x0uw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=05L/QFx4kyM1UqnbGE/ORzxwoDQ/tgXCO+v998Lwz+E=; fh=e1ROJJFFYvEk7QdwOgdfKaY3QEWq6gwg/C9qybV3Hz0=; b=icQNFlyk5ADLN0+5T6UFIMDCt+HdbFeUIzcGiZKqvLooXom8m95H9QnXisaM50SbeR IYHlYx7mOpEilKPO1KXjX9eejs8PvRThU5Sj15UtJYdwBGnBvhZ1xfTG5wjA/3wb1sRy I5L7lnT26N3JyLtCORtLD3oEKqso6UkxBRn7wGsF8PmJw9Qarn4Efn06m5eGZuLUfJlB 06xy78E3TmXimXL0HEpUSswbHIV+PDpYRED46ue8eQ1JmLqIrQo39XMCoAKW4d61WdkZ 7FvgbiDf0kMYo/vmatOMzM6M36Z0ZBPALdktBWNQJV7tkkhDSbNgzbUOcj7bMH7+RlSV 9hwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@proton.me header.s=m3froqkqbjc2pp2zduek3yuqkm.protonmail header.b=PSBu2eQy; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-97888-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gi12-20020a056214248c00b0068fb7f1120asi1498887qvb.328.2024.03.09.04.31.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Mar 2024 04:31:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97888-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=m3froqkqbjc2pp2zduek3yuqkm.protonmail header.b=PSBu2eQy; arc=pass (i=1 spf=pass spfdomain=proton.me dkim=pass dkdomain=proton.me dmarc=pass fromdomain=proton.me); spf=pass (google.com: domain of linux-kernel+bounces-97888-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97888-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 029911C20B53 for ; Sat, 9 Mar 2024 12:31:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D0C3A3BBC6; Sat, 9 Mar 2024 12:31:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="PSBu2eQy" Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47FE828E22; Sat, 9 Mar 2024 12:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.70.43.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709987466; cv=none; b=ppc8IZCHZ50tMmggnvTvfuGs7o+e4OpP4jlJuGGQ+U7erCO3MPQgA91QKlDGoVjS0i2brvRockw/zehd1pc25tFee1VLloDLa3R6ODGHAj1jE2D+Uv6AjbaMl//6YyIS3pqRptxSTL27sDZdKxDhm+MZT6B640NP0PGrZGnF8i4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709987466; c=relaxed/simple; bh=W7YTL00nz29DAGJaWkG4DPmr0d/GljxYJK7IQ9Pp/nU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aER59QFOaiOxlqtH/OF8MoBKC8rdUgDDAaMrERlNanKFARraOQyghjwxOpJhyWfbCH4IVacLUbo5Dax1CbYELvuLa3SOSi0PIM+UDaNVRbki3WbXc8acBxYGU1H1uQRx3OvL3FSfEgKWArzvTyQTDCaJFP2k3PR7ie+tj/A6wGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me; spf=pass smtp.mailfrom=proton.me; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b=PSBu2eQy; arc=none smtp.client-ip=185.70.43.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=m3froqkqbjc2pp2zduek3yuqkm.protonmail; t=1709987453; x=1710246653; bh=05L/QFx4kyM1UqnbGE/ORzxwoDQ/tgXCO+v998Lwz+E=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=PSBu2eQyi/6Nk+GyUT6L1k3cKFcixgwyETajG2gV1Qeq02Ai/SwEMRGeqY1Kir5Gv 9l3D5S1GZs+81EnrbegJQ2isiPgt8rEFXEx3HX4TMdsnbtpkFgAxMQiG62186QWHLz ggOhyc5Vlt3XCa7GbXUP3qdqapco38AckZE4pADWONbEK+ftVO9fewqVRvgN9JV1EH a6R2ugY1IRHaoaWhRjIMe0l5HSl9lG84yuSHohnPJ9rO6DfJADS0xHLjWAl0CRrzLh bop9NUyT8H59LU8gq1Wo5SR1SxVUopAiplXT2EAMZcsC/hDbPZPTOMCRggOgJt9ky/ P0NwT+znhTzsA== Date: Sat, 09 Mar 2024 12:30:49 +0000 To: Andreas Hindborg From: Benno Lossin Cc: Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Hannes Reinecke , lsf-pc@lists.linux-foundation.org, rust-for-linux@vger.kernel.org, linux-block@vger.kernel.org, Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , linux-kernel@vger.kernel.org, gost.dev@samsung.com Subject: Re: [RFC PATCH 04/11] rust: block: introduce `kernel::block::bio` module Message-ID: <6cd89162-a11f-4a2f-a609-b6d51caf6ba1@proton.me> In-Reply-To: <878r34aboo.fsf@metaspace.dk> References: <20230503090708.2524310-1-nmi@metaspace.dk> <20230503090708.2524310-5-nmi@metaspace.dk> <-SiJ5paRDIUkH1WEWhGhEjhIgFbSo5PJAvac53bTnBZ5o41DR-kNWZEQBsnKeW1FRJh35siVFRrx54L0M6ebSzl0rzecgcDjqZFGRa9uypE=@proton.me> <87a5pcyqf8.fsf@metaspace.dk> <878r34aboo.fsf@metaspace.dk> Feedback-ID: 71780778:user:proton Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2/28/24 15:31, Andreas Hindborg wrote: >=20 > Hi Benno, >=20 > "Andreas Hindborg (Samsung)" writes: >=20 > >=20 >>>> +); >>>> + >>>> +impl<'a> Bio<'a> { >>>> + /// Returns an iterator over segments in this `Bio`. Does not con= sider >>>> + /// segments of other bios in this bio chain. >>>> + #[inline(always)] >>> >>> Why are these `inline(always)`? The compiler should inline them >>> automatically? >> >> No, the compiler would not inline into modules without them. I'll check >> again if that is still the case. >=20 > I just tested this again. If I remove the attribute, the compiler will > inline some of the functions but not others. I guess it depends on the > inlining heuristics of rustc. The majority of the attributes I have put > is not necessary, since the compiler will inline by default. But for > instance `::next` is not inlined by default and > it really should be inlined. >=20 > Since most of the attributes do not change compiler default behavior, I > would rather tag all functions that I want inlined than have to > disassemble build outputs to check which functions actually need the > attribute. With this approach, we are not affected by changes to > compiler heuristics either. >=20 > What do you think? I think that you should do whatever leads to the best results in practice. I know that the compiler developers spend considerable time coming up with smart algorithms for deciding when and when not to inline functions. But they aren't perfect, so if you find them necessary then please add them. What I want to avoid is that we end up tagging every function `inline(always)`, or at least we do not check if it makes a difference. --=20 Cheers, Benno