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: <5124037f-03eb-4966-8b49-a6fac0fd3662@kernel.dk>
Date: Sat, 27 Jul 2024 10:52:32 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Linus Torvalds <torvalds@...uxfoundation.org>,
 David Laight <David.Laight@...lab.com>,
 "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

On 7/27/24 10:41 AM, Lorenzo Stoakes wrote:
>>> Patch attached including Jens's change + mine.
>>
>> bvec side matches what I have here, fwiw, except I also did
>> mp_bvec_iter_len(). Didn't see big expansion there, but might as well
>> keep them consistent.
> 
> Makes sense, am happy to give R-b tag for this patch if you want to put it
> forward? Not sure if Linus is minded to just pull something for this now?

Here's what I built (allmodconfig, gcc-14 and clang-20) and did a basic
boot of. Was just going to shove it into the 6.12 queue once posted, but
can go either way with this. Or Linus can just grab it and run with it,
not super particular ;-)

> If we're whack-a-moleing may as well sort the drivers I found in my
> allmodconfig too obviously as some hilariously low-hanging fruit there...

Oh I'm not, I got plenty of other things to tend to. Just got sucked
into the block side as that looked nuts, wanted to make that wasn't
insane.


diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index f41c7f0ef91e..1cb76a829b83 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;
+}
 
 #define mp_bvec_iter_offset(bvec, iter)				\
 	(__bvec_iter_bvec((bvec), (iter))->bv_offset + (iter).bi_bvec_done)
@@ -111,12 +116,15 @@ struct bvec_iter_all {
 #define mp_bvec_iter_page_idx(bvec, iter)			\
 	(mp_bvec_iter_offset((bvec), (iter)) / PAGE_SIZE)
 
-#define mp_bvec_iter_bvec(bvec, iter)				\
-((struct bio_vec) {						\
-	.bv_page	= mp_bvec_iter_page((bvec), (iter)),	\
-	.bv_len		= mp_bvec_iter_len((bvec), (iter)),	\
-	.bv_offset	= mp_bvec_iter_offset((bvec), (iter)),	\
-})
+static inline struct bio_vec mp_bvec_iter_bvec(const struct bio_vec *bv,
+					       struct bvec_iter iter)
+{
+	return (struct bio_vec) {
+		.bv_page	= mp_bvec_iter_page(bv, iter),
+		.bv_len		= mp_bvec_iter_len(bv, iter),
+		.bv_offset	= mp_bvec_iter_offset(bv, iter)
+	};
+}
 
 /* For building single-page bvec in flight */
  #define bvec_iter_offset(bvec, iter)				\
@@ -130,12 +138,15 @@ struct bvec_iter_all {
 	(mp_bvec_iter_page((bvec), (iter)) +			\
 	 mp_bvec_iter_page_idx((bvec), (iter)))
 
-#define bvec_iter_bvec(bvec, iter)				\
-((struct bio_vec) {						\
-	.bv_page	= bvec_iter_page((bvec), (iter)),	\
-	.bv_len		= bvec_iter_len((bvec), (iter)),	\
-	.bv_offset	= bvec_iter_offset((bvec), (iter)),	\
-})
+static inline struct bio_vec bvec_iter_bvec(const struct bio_vec *bv,
+					    struct bvec_iter iter)
+{
+	return (struct bio_vec) {
+		.bv_page	= bvec_iter_page(bv, iter),
+		.bv_len		= bvec_iter_len(bv, iter),
+		.bv_offset	= bvec_iter_offset(bv, iter)
+	};
+}
 
 static inline bool bvec_iter_advance(const struct bio_vec *bv,
 		struct bvec_iter *iter, unsigned bytes)

-- 
Jens Axboe


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ