diff mbox series

[12/14] block: align blkdev_dio inlined bio to a cacheline

Message ID 20211017013748.76461-13-axboe@kernel.dk (mailing list archive)
State New, archived
Headers show
Series Various block layer optimizations | expand

Commit Message

Jens Axboe Oct. 17, 2021, 1:37 a.m. UTC
We get all sorts of unreliable and funky results since the bio is
designed to align on a cacheline, which it does not when inlined like
this.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 block/fops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Oct. 18, 2021, 9:21 a.m. UTC | #1
On Sat, Oct 16, 2021 at 07:37:46PM -0600, Jens Axboe wrote:
> We get all sorts of unreliable and funky results since the bio is
> designed to align on a cacheline, which it does not when inlined like
> this.

Well, I guess you'll need to audit all the front_pad users for
something like this then?
Jens Axboe Oct. 18, 2021, 2:36 p.m. UTC | #2
On 10/18/21 3:21 AM, Christoph Hellwig wrote:
> On Sat, Oct 16, 2021 at 07:37:46PM -0600, Jens Axboe wrote:
>> We get all sorts of unreliable and funky results since the bio is
>> designed to align on a cacheline, which it does not when inlined like
>> this.
> 
> Well, I guess you'll need to audit all the front_pad users for
> something like this then?

It's not a correctness issue, it's just less efficient. Not really
a new thing.
diff mbox series

Patch

diff --git a/block/fops.c b/block/fops.c
index 1d4f862950bb..7eebd590342b 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -137,7 +137,7 @@  struct blkdev_dio {
 	size_t			size;
 	atomic_t		ref;
 	unsigned int		flags;
-	struct bio		bio;
+	struct bio		bio ____cacheline_aligned_in_smp;
 };
 
 static struct bio_set blkdev_dio_pool;