Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp8643157rwd; Tue, 20 Jun 2023 18:54:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4i0UyJ08/vvroqUmgZw0Q9Xqm/a/II7x557Qv25EGXO0mR1RruuATr2t6/cOPjNZjkDDfW X-Received: by 2002:a17:903:25ca:b0:1af:b957:718b with SMTP id jc10-20020a17090325ca00b001afb957718bmr9705023plb.39.1687312485188; Tue, 20 Jun 2023 18:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687312485; cv=none; d=google.com; s=arc-20160816; b=NbeE6K0sQcnwQUytoVs+5WG1LN8VxFjaMfDEGlO15VV7huamxNrwull53hx13LeOIl Co2bmMmgSJG/0GrtETrIHYQKLl5kMFUedjdj5m4j8AZi00F7sWP20o6OUHmorV+OrYLh 1s2AIRZyZRlZfK8QitkOwFpO70Hz2NtsNMth7MX8xm6n3ixH+q8DYirUfpc6jtFz/eHR hpVd6Y11sz2NwlcfMfpli1oy23PkOokueIsMtN9IR0ouv2xnII1TlnOXh+DdSQS0QBeo bUD6wFyYmy+rmKw0956Pm2iS7kRqkZFCpxm9boJeQe2CIjCHvOweESUm312SmPP+au8v Affg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:cc:to:from :date:references:in-reply-to:message-id:mime-version:user-agent :feedback-id:dkim-signature; bh=k3mjmpG7iRCWAjgZY0tdNrZMRPGN4cyq4SSN3Cmxwgo=; b=cMarWgWtFlG4QOLSC/gaRX3OnuCmjr7TLjlDBAShDYe2lFtEwjak3POQH3qkdTaNHD TgfCixpa4PhTKdomO/6KSLL7kOenTFoXx6Tilk5ukgF6/IlJ4nv94++iZmFGirYjZk9X rkyCesma7ubk7m1yHEDbZICz0IZQVKmBAV8Dun3r+wvbl286lWlKfUnh1ttdOnDR4Op0 IF/d49u1TPAeQMSnSZ5YzylPw+QyTDqX8mUU5fLd0WwwnqmkhdApKElSzK7oGZZ9BlxB 30D9M/pOSFqCiqlx8R2VpZmuasM4LLH9suFz8WGKN1R8Xu2FQ1W/teHztzI+2U/WheUO lOBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=idkFXeEy; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id le8-20020a170902fb0800b001b675acd5b1si2886086plb.341.2023.06.20.18.54.30; Tue, 20 Jun 2023 18:54:45 -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=@kernel.org header.s=k20201202 header.b=idkFXeEy; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229990AbjFUB1c (ORCPT + 99 others); Tue, 20 Jun 2023 21:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjFUB1a (ORCPT ); Tue, 20 Jun 2023 21:27:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBCCC1726 for ; Tue, 20 Jun 2023 18:27:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 66CC66144F for ; Wed, 21 Jun 2023 01:27:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 225DCC433C9; Wed, 21 Jun 2023 01:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687310846; bh=1otvnE5+wHePKnvvLsl/wIH5ilQt0tl8E7t6o0z9JvU=; h=In-Reply-To:References:Date:From:To:Cc:Subject:From; b=idkFXeEyGpeDCjbeK9q/lEYwkPL0bPEmfzHxWY8qunk+b6R7WmjsARsmDIwy2fYJE DYsTtIwM3ddhdbgNOFUQH7Ojtrrb/WQ2200GSJUvZauRsV29B85/EOTofs7oXFvNtW iFUFo9RShIk9mZhb2ergNJqVuaISFV4KGBkdSMbbp2ysd9xKW6IQ0YaodC3aUqfimJ NNylsxJhJKADtiHV3PlH8oIfL7f5QUVRBl6lfcTi+mpmiFB/mtGjG/dOrEUIYz+/Fp t7BfECvUu1d4Nlku3sT3DKy7x3Yiqyf6nEEcyKL5loJWGistZj5lYmWKsA6Qa1srY2 fTElDlnCHkdmw== Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 035FC27C0054; Tue, 20 Jun 2023 21:27:24 -0400 (EDT) Received: from imap48 ([10.202.2.98]) by compute3.internal (MEProxy); Tue, 20 Jun 2023 21:27:25 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeefiedggeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtgfesthhqredtreerjeenucfhrhhomhepfdet nhguhicunfhuthhomhhirhhskhhifdcuoehluhhtoheskhgvrhhnvghlrdhorhhgqeenuc ggtffrrghtthgvrhhnpeelleehueeuudegjefglefftddtieetudduuefgveejhedtgfel leeggfegjeejjeenucffohhmrghinhepghhouggsohhlthdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhguhidomhgvshhmthhp rghuthhhphgvrhhsohhnrghlihhthidqudduiedukeehieefvddqvdeifeduieeitdekqd hluhhtoheppehkvghrnhgvlhdrohhrgheslhhinhhugidrlhhuthhordhush X-ME-Proxy: Feedback-ID: ieff94742:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7A20531A0063; Tue, 20 Jun 2023 21:27:24 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-499-gf27bbf33e2-fm-20230619.001-gf27bbf33 Mime-Version: 1.0 Message-Id: <1be708d5-638c-40ff-bd52-b6b88c93d132@app.fastmail.com> In-Reply-To: References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-8-kent.overstreet@linux.dev> <20230619104717.3jvy77y3quou46u3@moria.home.lan> <20230619191740.2qmlza3inwycljih@moria.home.lan> <5ef2246b-9fe5-4206-acf0-0ce1f4469e6c@app.fastmail.com> <20230620180839.oodfav5cz234pph7@moria.home.lan> <37d2378e-72de-e474-5e25-656b691384ba@intel.com> Date: Tue, 20 Jun 2023 18:27:04 -0700 From: "Andy Lutomirski" To: "Nadav Amit" Cc: "Dave Hansen" , "Kent Overstreet" , "Mark Rutland" , "Linux Kernel Mailing List" , linux-fsdevel@vger.kernel.org, "linux-bcachefs@vger.kernel.org" , "Kent Overstreet" , "Andrew Morton" , "Uladzislau Rezki" , "hch@infradead.org" , linux-mm , "Kees Cook" , "the arch/x86 maintainers" Subject: Re: [PATCH 07/32] mm: Bring back vmalloc_exec Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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, Jun 20, 2023, at 3:43 PM, Nadav Amit wrote: >> On Jun 20, 2023, at 3:32 PM, Andy Lutomirski wrote: >>=20 >>> // out needs to be zeroed first >>> void unpack(struct uncompressed *out, const u64 *in, const struct=20 >>> bitblock *blocks, int nblocks) >>> { >>> u64 *out_as_words =3D (u64*)out; >>> for (int i =3D 0; i < nblocks; i++) { >>> const struct bitblock *b; >>> out_as_words[b->target] |=3D (in[b->source] & b->mask) <<=20 >>> b->shift; >>> } >>> } >>>=20 >>> void apply_offsets(struct uncompressed *out, const struct uncompress= ed *offsets) >>> { >>> out->a +=3D offsets->a; >>> out->b +=3D offsets->b; >>> out->c +=3D offsets->c; >>> out->d +=3D offsets->d; >>> out->e +=3D offsets->e; >>> out->f +=3D offsets->f; >>> } >>>=20 >>> Which generates nice code: https://godbolt.org/z/3fEq37hf5 >>=20 >> Thinking about this a bit more, I think the only real performance iss= ue with my code is that it does 12 read-xor-write operations in memory, = which all depend on each other in horrible ways. > > If you compare the generated code, just notice that you forgot to=20 > initialize b in unpack() in this version. > > I presume you wanted it to say "b =3D &blocks[i]=E2=80=9D. Indeed. I also didn't notice that -Wall wasn't set. Oops.