lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b77025b520f439692e6fc2851977a0d@AcuMS.aculab.com>
Date: Sun, 28 Jul 2024 11:32:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Lorenzo Stoakes' <lorenzo.stoakes@...cle.com>, Jens Axboe
	<axboe@...nel.dk>
CC: Linus Torvalds <torvalds@...uxfoundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "Matthew
 Wilcox (Oracle)" <willy@...radead.org>, Christoph Hellwig
	<hch@...radead.org>, Andrew Morton <akpm@...ux-foundation.org>, "Andy
 Shevchenko" <andriy.shevchenko@...ux.intel.com>, Dan Carpenter
	<dan.carpenter@...aro.org>, Arnd Bergmann <arnd@...nel.org>,
	"Jason@...c4.com" <Jason@...c4.com>, "pedro.falcato@...il.com"
	<pedro.falcato@...il.com>, Mateusz Guzik <mjguzik@...il.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>
Subject: RE: [PATCH 0/7] minmax: reduce compilation time

From: Lorenzo Stoakes
> Sent: 27 July 2024 17:31
>
...
> I tried this patch, doesn't seem to make a huge difference, going from
> 3,958,564 bytes with longest line of 82 kB to 3,943,824 bytes with a
> longest line of 77kB.
> 
> It seems that the .bv_len = ... expansion is what's doing it, so I tried
> patching mp_bvec_iter_len() as well to do a silly ?: thing (sorry), which
> takes us down to 3,880,309 with longest line of 20kB.
> 
...
> diff --git a/include/linux/bvec.h b/include/linux/bvec.h
> index f41c7f0ef91e..567522aec2f9 100644
> --- a/include/linux/bvec.h
> +++ b/include/linux/bvec.h
> @@ -101,9 +101,14 @@ struct bvec_iter_all {
>  #define mp_bvec_iter_page(bvec, iter)				\
>  	(__bvec_iter_bvec((bvec), (iter))->bv_page)
> 
> -#define mp_bvec_iter_len(bvec, iter)				\
> -	min((iter).bi_size,					\
> -	    __bvec_iter_bvec((bvec), (iter))->bv_len - (iter).bi_bvec_done)
> +static inline unsigned mp_bvec_iter_len(const struct bio_vec *bvec,
> +					struct bvec_iter iter)
> +{
> +	unsigned remains = __bvec_iter_bvec(bvec, iter)->bv_len -
> +		iter.bi_bvec_done;
> +
> +	return remains < iter.bi_size ? remains : iter.bi_size;
> +}

That can still be a #define and still use min().
The important thing is to assign the result of __bvec_iter_bvec() to
a local variable.

So maybe something like:
#define mp_bvec_iter_len(bvec, iter) ({ \
	__auto_type _remains = __bvec_iter_bvec((bvec), \
		(iter))->bv_len - (iter).bi_bvec_done); \
	min((iter).bi_size, _remains); \
})

Bloat is always going to happen if you pass one complex #define to another.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ