RE: [PATCH 0/7] minmax: reduce compilation time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux