Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4961050rwd; Sun, 4 Jun 2023 17:27:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6N2P75wZCQ1E/HX6A9GR5q2CiEdY43dncOgEq+APeWTGsKzzWWV+RNSucJBdX3sTcW5Wp+ X-Received: by 2002:a05:6870:e145:b0:1a2:ae9a:749c with SMTP id z5-20020a056870e14500b001a2ae9a749cmr6916919oaa.42.1685924852497; Sun, 04 Jun 2023 17:27:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685924852; cv=none; d=google.com; s=arc-20160816; b=gud31RZosLgsZ0geGx29NZ+55u6Ns44RAIEs9sRJnbllYEaGI4yp52ZYcjZgy+vb0S paguuKrKih7v8bdCdjfQJa5SXi8cgcq0wr3j6ZXauCABwY1UcaOUSCbSrkFvxlk98qAv +dOwfnLcl6a0xYtQfkEHbVYvGGInvERDpfCnN0pzILndWFfysdhLTx3J/qhuTTBMnvcA eo9jffyT7eo1UFxHjRvyTyEkSSo1O/p7R22rd4+hjDMxRJdwsp1YwH0xPMathEDC9P0Z gqyAfmhl99IINblhvohFBJ/13kN+Cb4W6a1bwHI3uCyxKEBxShlz3Bor+WUWtUrUKdGc vuKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=uVV3yjs4kWVzhhx/jsq5Z0tB6otLGDTtFTIwSZr9j+c=; b=J51lHqWkkpCCTUAwIdRxqMdtbRgTtTBFG3EXeJ+GQ7AWdF9HrfS27XkWJ5/PPUSKJs DH+4mm62X0a/6xp8aZdICdDDb9HVP8DfhvpPE7itJ8c/17lzoRAeeS7Nq4llTeQ7Rwhj R0ax9A7Nkpxq46Pi8vV/WNtM3BnEd4DGXuhVGH2TO8JrATPBmR0SgEyOx3Zn33PRjbJC IgGfc9aNpzbdPO4NetMO4qwdULDP0Phep+/k/SJ/dqDTTtoT0I971mbIqQB0h4TRs3Za mV7YdE4FsoyaZDlBqMCxYWMHwZ4yDP/8q7fOOF6alkV6gp3ncV2RjnqBpHdMoIopDMwX YY1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=EOPfTYA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g127-20020a636b85000000b00543bfe3eb09si292868pgc.804.2023.06.04.17.27.15; Sun, 04 Jun 2023 17:27:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=EOPfTYA3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbjFDXjE (ORCPT + 99 others); Sun, 4 Jun 2023 19:39:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjFDXjC (ORCPT ); Sun, 4 Jun 2023 19:39:02 -0400 Received: from out-13.mta0.migadu.com (out-13.mta0.migadu.com [IPv6:2001:41d0:1004:224b::d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45839D2 for ; Sun, 4 Jun 2023 16:39:01 -0700 (PDT) Date: Sun, 4 Jun 2023 19:38:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1685921939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uVV3yjs4kWVzhhx/jsq5Z0tB6otLGDTtFTIwSZr9j+c=; b=EOPfTYA3F0a6RtdIdrmU5x9GpdaD6sOglMygl8F8JDqYWn5YKqJ+qIBCx/PBPzs6o9eQ2Q TJceDQRJN5rMDhWkZzIrWm86IANSXMx70+67IJKQi4vEw0y/0CCqfTQECaPC+qREXDsRwR 7T2Bc/Po+zaMlhPBmIS6HPT4RG3jWFk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Jens Axboe Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 0/7] block layer patches for bcachefs Message-ID: References: <20230525214822.2725616-1-kent.overstreet@linux.dev> <8e874109-db4a-82e3-4020-0596eeabbadf@kernel.dk> <2a56b6d4-5f24-9738-ec83-cefb20998c8c@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2a56b6d4-5f24-9738-ec83-cefb20998c8c@kernel.dk> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 30, 2023 at 10:50:55AM -0600, Jens Axboe wrote: > Sorry typo, I meant text. Just checked stack and it looks identical, but > things like blk-map grows ~6% more text, and bio ~3%. Didn't check all > of them, but at least those two are consistent across x86-64 and > aarch64. Ditto on the data front. Need to take a closer look at where > exactly that is coming from, and what that looks like. A good chunk of that is because I added warnings and assertions for e.g. running past the end of the bvec array. These bugs are rare and shouldn't happen with normal iterator usage (e.g. the bio_for_each_* macros), but I'd like to keep them as a debug mode thing. But we don't yet have CONFIG_BLOCK_DEBUG - perhaps we should. With those out, I see a code size decrease in bio.c, which makes sense - gcc ought to be able to generate slightly better code when it's dealing with pure values, provided everything is inlined and there's no aliasing considerations. Onto blk-map.c: bio_copy_kern_endio_read() increases in code size, but if I change memcpy_from_bvec() to take the bvec by val instead of by ref it's basically the same code size. There's no disadvantage to changing memcpy_from_bvec() to pass by val. bio_copy_(to|from)_iter() is a wtf, though - gcc is now spilling the constructed bvec to the stack; my best guess is it's a register pressure thing (but we shouldn't be short registers here!). So, since the fastpath stuff in bio.c gets smaller and blk-map.c is not exactly fastpath stuff I'm not inclined to fight with gcc on this one - let me know if that works for you. Branch is updated - I split out the new assertions into a separate patch that adds CONFIG_BLK_DEBUG, and another patch for mempcy_(to|from)_bio() for a small code size decrease. https://evilpiepirate.org/git/bcachefs.git/log/?h=block-for-bcachefs or git pull http://evilpiepirate.org/git/bcachefs.git block-for-bcachefs