[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191130220458.GA297712@rani.riverdale.lan>
Date: Sat, 30 Nov 2019 17:05:00 -0500
From: Arvind Sankar <nivedita@...m.mit.edu>
To: Pavel Begunkov <asml.silence@...il.com>
Cc: Jens Axboe <axboe@...nel.dk>, nivedita@...m.mit.edu,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] block: optimise bvec_iter_advance()
On Sat, Nov 30, 2019 at 11:23:52PM +0300, Pavel Begunkov wrote:
> bvec_iter_advance() is quite popular, but compilers fail to do proper
> alias analysis and optimise it good enough. The assembly is checked
> for gcc 9.2, x86-64.
>
> - remove @iter->bi_size from min(...), as it's always less than @bytes.
> Modify at the beginning and forget about it.
>
> - the compiler isn't able to collapse memory dependencies and remove
> writes in the loop. Help it by explicitely using local vars.
>
> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
> ---
>
> v2: simplify code (Arvind Sankar)
>
Thanks :)
Signed-off-by: Arvind Sankar <nivedita@...m.mit.edu>
Btw, I discovered that gcc 9.2 doesn't optimize away the second
comparison in something like
m = min(a,b);
return m>a;
So the WARN_ONCE bit doesn't get optimized away even in cases like
bio_for_each_bvec where it's guaranteed at compile-time to not trigger.
Powered by blists - more mailing lists