Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1758696lqe; Mon, 8 Apr 2024 21:47:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVeOHJVqQRJR2HsVdEB7g1GptczR9EVH149EEw7xnq8bza6AvKnmQXIp1PpvqEYLNgTdzdcpguiytNO8BswcXE1YxHVb2p57Bc4baviGA== X-Google-Smtp-Source: AGHT+IE/VsmRoQTj86QuAusGgQPn1bt2jY3rxn9truOZg0yTpguSVjZ/fNhqVZOLi9vFYIQC+GDi X-Received: by 2002:a05:620a:110d:b0:78d:5714:6698 with SMTP id o13-20020a05620a110d00b0078d57146698mr8355687qkk.4.1712638054712; Mon, 08 Apr 2024 21:47:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712638054; cv=pass; d=google.com; s=arc-20160816; b=rL1kx8LgByfUw5NzqKt/uUHRu8PG+SZ1VUPiyDdWrZ1R0aVxLg90kCBko3HPeJ/KAY BXQvES02NoXZxlXmtXIKC0qm4UvddIZvPOON6ItQ+8q+FXKADjMlYaSM85+AcrkBI6Tj 6L7crvIAYOuXbCD3rnEkcAQMKqdP2XeKYS6w56bmxMjebl7R7ks60FelvU5i8tGEcJtL aflpvwi6kjfGGuNqdPsAKouksE/92tZj4+vewdJTwxMCiGv95iUBhECUr2MAfszo1X6X E0Tx+6Gq+MgsUBkihcyD3Oi2LjN3xwSmXcVwztPx0m4pb0Np09Jdb8siDiZ9x8Et1+qK ARVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=7yvI5oJCBNqTv4+IecwcOKw1VzStxB/KFaPbHG/AtFg=; fh=Qm2giNI+wuTodwkChoZODbwmp+QhRJxwtzfSmfTtO/w=; b=Y4J81vPrQ/li9vg6fcUnTVE2zV0k0KrcsLFIHpA19bznLr1jN34nZcrkdrGTemhsCs uY6Sdnor99rccx7fUr7u004CDfvq9heBFcZYux7kp926Gfq3c3haZji039CASifrX0Uu aI6HgMjkxk2sCLS8m85NgJKTwOOw9rcDKcWzSN/cjaU0XYcNYV/3IjDQewugRou66bG9 s+HwfFtkdvc/wPLQ/VYIW32uJ6pNgdqL2gH8uu1ktqZG6EaCPrfjBDuoztBxuLTcC923 3MfXPwx2XRb1Qk2sILM3cJLLa2xvd484W8OCp6XE4YRxeydDkcVBM0B7Zy89T/jN4DX0 YR5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1TuIwKI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136239-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136239-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id az38-20020a05620a172600b0078d619b94c9si5389051qkb.433.2024.04.08.21.47.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 21:47:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136239-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X1TuIwKI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136239-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136239-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 77A051C2419D for ; Tue, 9 Apr 2024 04:47:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 80B5B5B1EA; Tue, 9 Apr 2024 04:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X1TuIwKI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9A6613BBE4; Tue, 9 Apr 2024 04:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712638025; cv=none; b=sYLEMwWgx4tPHuSEU9FxyHEiRgMXUoTMZgj2KH8cOvIYJ+V5ZXYAHBqeIMC+UlLCi0jldS3DgKwFiT/L4rpIFvra26MVmKtOC6V2X8doBjr5/2FHtuN0UTx49keL1qm64iue3OHbavf4FOBpZOZSfjt3nmuNW6Q+J/sAdAsraXY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712638025; c=relaxed/simple; bh=/wRns2YHr/e81UAE5ln2nftiOF08Py5b8V2ul1ELJLo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kOYjYKpg1TZAgZWHhGw+EU1tewpVcEEFTeAJBRu6L3dcVsyysYgZApFJGh42X7V7grd8jaOjIPiUvB08YaQZkOyPeoIPd/OIZqzpw0FL7z7iwUCSta/Wy0jbf6fxHM7/Hocl1yHg3G+Czlz9GHX/I40rgmRpBkkhyxJrBlClAw4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X1TuIwKI; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A1ABC433F1; Tue, 9 Apr 2024 04:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712638025; bh=/wRns2YHr/e81UAE5ln2nftiOF08Py5b8V2ul1ELJLo=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=X1TuIwKIKFgH28lx1aWSzHSc/l9q/5WsShWTyf1COXe+KH8o5qkJx/+4l/MZAGdp5 tY3Ii6O3xstLwGlLDwl0ILyJ7iLmlhqJpVaf9zwMAbt2nTNVKmLFa7ltyTVmS1NTjZ tGQeJYyeNoqkSiziXYMahy4CWp65HxqT8GXv8eYg5hxNH7UTpcJlX4wLvi5xJ22Ds+ gB4OedgEhtiGv0uIRIAN1xSU0atqatc0m59MImyALJFnXLBTf2f8uK3EZb/RfJs8NM /sxh6FUkFe9z/bUfWj9DDmpuNCe2M5nqp4kqYkxUFErlAYmYmP2tP3htmQfirFktDf Og+X9lFiXyI0g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B751ACE12F2; Mon, 8 Apr 2024 21:47:04 -0700 (PDT) Date: Mon, 8 Apr 2024 21:47:04 -0700 From: "Paul E. McKenney" To: Kent Overstreet Cc: Matthew Wilcox , Linus Torvalds , Philipp Stanner , Boqun Feng , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Nathan Chancellor , Nick Desaulniers , kent.overstreet@gmail.com, Greg Kroah-Hartman , elver@google.com, Mark Rutland , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-fsdevel@vger.kernel.org Subject: Re: [WIP 0/3] Memory model and atomic API in Rust Message-ID: <6fa87fef-5676-4a26-86d9-45eca6ebd798@paulmck-laptop> Reply-To: paulmck@kernel.org References: 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=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Apr 08, 2024 at 08:58:18PM -0400, Kent Overstreet wrote: > On Mon, Apr 08, 2024 at 06:03:11PM +0100, Matthew Wilcox wrote: > > On Mon, Apr 08, 2024 at 09:55:23AM -0700, Paul E. McKenney wrote: > > > On Mon, Apr 08, 2024 at 05:02:37PM +0100, Matthew Wilcox wrote: > > > > In my ideal world, the compiler would turn this into: > > > > > > > > newfolio->flags |= folio->flags & MIGRATE_MASK; > > > > > > Why not accumulate the changes in a mask, and then apply the mask the > > > one time? (In situations where __folio_set_foo() need not apply.) > > > > But it irks me that we can't tell the compiler this is a safe > > transformation for it to make. There are a number of places where > > similar things happen. > > Same thing comes up with bignum code - you really want to be able to > tell the compiler "you can apply x/y/z optimizations for these > functions", e.g. replace add(mul(a, b), c) with fma(a, b, c). > > Compiler optimizations are just algebraic transformations, we just need > a way to tell the compiler what the algebraic properties of our > functions are. That might indeed be more straightforward than doing this on a per-type basis. But the C++ guys would likely just start shouting "template metaprogramming!!!" ;-) Thanx, Paul