[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-arch
Subject:    Re: [WIP 0/3] Memory model and atomic API in Rust
From:       Kent Overstreet <kent.overstreet () linux ! dev>
Date:       2024-04-09 0:58:18
Message-ID: bmbsx3zfgedqo5ef6yzzvpnwx2ukhzhm33ovb6zyhq4g6vutnn () b7qlnf2pyxvj
[Download RAW message or body]

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.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic