All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	colyli-l3A5Bk7waGM@public.gmane.org,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	clm-b10kYP2dOMg@public.gmane.org,
	neilb-IBi9RG/b67k@public.gmane.org,
	bacik-b10kYP2dOMg@public.gmane.org,
	Kent Overstreet
	<kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	drbd-dev-cunTk1MwBs8qoQakbn7OcQ@public.gmane.org
Subject: Re: [PATCH 00/13] convert block layer to bioset_init()/mempool_init()
Date: Tue, 22 May 2018 15:09:34 -0400	[thread overview]
Message-ID: <20180522190933.GA25904@redhat.com> (raw)
In-Reply-To: <20180522064118.GA18704-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>

On Tue, May 22 2018 at  2:41am -0400,
Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> wrote:

> On Mon, May 21, 2018 at 07:38:55PM -0400, Kent Overstreet wrote:
> > On Mon, May 21, 2018 at 02:24:32PM -0400, Mike Snitzer wrote:
> > > Every single data structure change in this series should be reviewed for
> > > unforeseen alignment consequences.  Jens seemed to say that is
> > > worthwhile.  Not sure if he'll do it or we divide it up.  If we divide
> > > it up a temp topic branch should be published for others to inspect.
> > > 
> > > Could be alignment hasn't been a historic concern for a bunch of the
> > > data structures changed in this series.. if so then all we can do is fix
> > > up any obvious potential for false sharing.
> > 
> > Honestly, I almost never worry about alignment... the very few times I do care,
> > I use __cacheline_aligned_in_smp.
> 
> And that generally is the right stratgey.  If Mike really doesn't want
> a change we can just open code the kmalloc for the bio set there, the
> important point is that we should not keep the old API around for no
> good reason.

Again, I never said I didn't want these changes.  I just thought it
worthwhile to mention the potential for alignment quirks arising.

Reality is false sharing is quite uncommon.  So my concern was/is pretty
niche and unlikely to be applicable.

That said, I did take the opportunity to look at all the DM structures
that were modified.  The bio_set and mempool_t structs are so large that
they span multiple cachelines as is.  So I focused on eliminating
unnecessary spanning of cachelines (by non-bio_set and non-mempool_t
members) and eliminated most holes in DM structs.  This is the result:
http://people.redhat.com/msnitzer/dm-4.18-struct-reorg/

Compare before.txt vs after_kent.txt vs after_mike.txt

Nothing staggering or special.  Just something I'll add once Kent's
latest changes land.

But, I also eliminated 2 4-byte holes in struct bio_set, Jens please
feel free to pick this up (if you think it useful):

From: Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH] block: eliminate 2 4-byte holes in bio_set structure

Signed-off-by: Mike Snitzer <snitzer-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 include/linux/bio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5e472fc..e6fc692 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -735,7 +735,6 @@ static inline void bio_inc_remaining(struct bio *bio)
 
 struct bio_set {
 	struct kmem_cache *bio_slab;
-	unsigned int front_pad;
 
 	mempool_t bio_pool;
 	mempool_t bvec_pool;
@@ -743,6 +742,7 @@ struct bio_set {
 	mempool_t bio_integrity_pool;
 	mempool_t bvec_integrity_pool;
 #endif
+	unsigned int front_pad;
 
 	/*
 	 * Deadlock avoidance for stacking block drivers: see comments in

WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Kent Overstreet <kent.overstreet@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
	colyli@suse.de, darrick.wong@oracle.com, clm@fb.com,
	bacik@fb.com, linux-xfs@vger.kernel.org,
	drbd-dev@lists.linbit.com, linux-btrfs@vger.kernel.org,
	linux-raid@vger.kernel.org, neilb@suse.com
Subject: Re: [PATCH 00/13] convert block layer to bioset_init()/mempool_init()
Date: Tue, 22 May 2018 15:09:34 -0400	[thread overview]
Message-ID: <20180522190933.GA25904@redhat.com> (raw)
In-Reply-To: <20180522064118.GA18704@infradead.org>

On Tue, May 22 2018 at  2:41am -0400,
Christoph Hellwig <hch@infradead.org> wrote:

> On Mon, May 21, 2018 at 07:38:55PM -0400, Kent Overstreet wrote:
> > On Mon, May 21, 2018 at 02:24:32PM -0400, Mike Snitzer wrote:
> > > Every single data structure change in this series should be reviewed for
> > > unforeseen alignment consequences.  Jens seemed to say that is
> > > worthwhile.  Not sure if he'll do it or we divide it up.  If we divide
> > > it up a temp topic branch should be published for others to inspect.
> > > 
> > > Could be alignment hasn't been a historic concern for a bunch of the
> > > data structures changed in this series.. if so then all we can do is fix
> > > up any obvious potential for false sharing.
> > 
> > Honestly, I almost never worry about alignment... the very few times I do care,
> > I use __cacheline_aligned_in_smp.
> 
> And that generally is the right stratgey.  If Mike really doesn't want
> a change we can just open code the kmalloc for the bio set there, the
> important point is that we should not keep the old API around for no
> good reason.

Again, I never said I didn't want these changes.  I just thought it
worthwhile to mention the potential for alignment quirks arising.

Reality is false sharing is quite uncommon.  So my concern was/is pretty
niche and unlikely to be applicable.

That said, I did take the opportunity to look at all the DM structures
that were modified.  The bio_set and mempool_t structs are so large that
they span multiple cachelines as is.  So I focused on eliminating
unnecessary spanning of cachelines (by non-bio_set and non-mempool_t
members) and eliminated most holes in DM structs.  This is the result:
http://people.redhat.com/msnitzer/dm-4.18-struct-reorg/

Compare before.txt vs after_kent.txt vs after_mike.txt

Nothing staggering or special.  Just something I'll add once Kent's
latest changes land.

But, I also eliminated 2 4-byte holes in struct bio_set, Jens please
feel free to pick this up (if you think it useful):

From: Mike Snitzer <snitzer@redhat.com>
Subject: [PATCH] block: eliminate 2 4-byte holes in bio_set structure

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 include/linux/bio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/bio.h b/include/linux/bio.h
index 5e472fc..e6fc692 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -735,7 +735,6 @@ static inline void bio_inc_remaining(struct bio *bio)
 
 struct bio_set {
 	struct kmem_cache *bio_slab;
-	unsigned int front_pad;
 
 	mempool_t bio_pool;
 	mempool_t bvec_pool;
@@ -743,6 +742,7 @@ struct bio_set {
 	mempool_t bio_integrity_pool;
 	mempool_t bvec_integrity_pool;
 #endif
+	unsigned int front_pad;
 
 	/*
 	 * Deadlock avoidance for stacking block drivers: see comments in

  parent reply	other threads:[~2018-05-22 19:09 UTC|newest]

Thread overview: 73+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 22:25 [PATCH 00/13] convert block layer to bioset_init()/mempool_init() Kent Overstreet
2018-05-20 22:25 ` [PATCH 01/12] block: convert bounce, q->bio_split " Kent Overstreet
2018-05-22 10:08   ` Christoph Hellwig
2018-05-20 22:25 ` [PATCH 02/12] drbd: convert " Kent Overstreet
2018-05-20 22:25 ` [PATCH 03/12] pktcdvd: " Kent Overstreet
2018-05-20 22:25 ` [PATCH 04/12] lightnvm: " Kent Overstreet
2018-05-22 10:10   ` Javier Gonzalez
2018-05-20 22:25 ` [PATCH 05/12] bcache: " Kent Overstreet
2018-05-21  3:58   ` Coly Li
2018-05-20 22:25 ` [PATCH 06/12] md: " Kent Overstreet
2018-06-01 10:51   ` Arnd Bergmann
2018-05-20 22:25 ` [PATCH 07/12] dm: " Kent Overstreet
     [not found]   ` <20180520222558.7053-8-kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-30 19:27     ` Mike Snitzer
2018-05-30 19:27       ` Mike Snitzer
2018-05-20 22:25 ` [PATCH 08/12] target: " Kent Overstreet
2018-05-22 10:09   ` Christoph Hellwig
2018-05-20 22:25 ` [PATCH 09/12] fs: convert block_dev.c to bioset_init() Kent Overstreet
2018-05-22 10:09   ` Christoph Hellwig
2018-05-20 22:25 ` [PATCH 10/12] btrfs: convert to bioset_init()/mempool_init() Kent Overstreet
2018-05-30 21:30   ` Chris Mason
2018-05-30 21:30     ` Chris Mason
2018-05-20 22:25 ` [PATCH 11/12] xfs: " Kent Overstreet
2018-05-21 18:39   ` Darrick J. Wong
     [not found]   ` <20180520222558.7053-12-kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-22 10:10     ` Christoph Hellwig
2018-05-22 10:10       ` Christoph Hellwig
2018-05-20 22:25 ` [PATCH 12/12] block: Drop bioset_create() Kent Overstreet
2018-05-22 10:10   ` Christoph Hellwig
2018-05-20 23:08 ` [PATCH 00/13] convert block layer to bioset_init()/mempool_init() NeilBrown
2018-05-20 23:08   ` NeilBrown
2018-05-20 23:11   ` Kent Overstreet
     [not found] ` <20180520222558.7053-1-kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-21 14:03   ` Mike Snitzer
2018-05-21 14:03     ` Mike Snitzer
2018-05-21 14:19     ` Jens Axboe
     [not found]       ` <686d7df6-c7d1-48a6-b7ff-48dc8aff6a62-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-21 14:31         ` Mike Snitzer
2018-05-21 14:31           ` Mike Snitzer
2018-05-21 14:36           ` Jens Axboe
     [not found]             ` <2bbeeb1a-8b99-b06a-eb9b-eb8523c16460-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-21 14:47               ` Mike Snitzer
2018-05-21 14:47                 ` Mike Snitzer
     [not found]                 ` <20180521144703.GA19303-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-21 14:52                   ` Jens Axboe
2018-05-21 14:52                     ` Jens Axboe
     [not found]                     ` <4b343aef-e11c-73ba-1d88-7e73ca838cad-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-21 15:04                       ` Mike Snitzer
2018-05-21 15:04                         ` Mike Snitzer
     [not found]                         ` <20180521150439.GA19379-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-21 15:09                           ` Jens Axboe
2018-05-21 15:09                             ` Jens Axboe
     [not found]                             ` <61e30dcf-a01c-f47d-087a-12930caf9aef-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-21 15:18                               ` Mike Snitzer
2018-05-21 15:18                                 ` Mike Snitzer
     [not found]                                 ` <20180521151817.GA19454-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-21 15:36                                   ` Jens Axboe
2018-05-21 15:36                                     ` Jens Axboe
     [not found]                                     ` <d01a150a-7752-f6ce-78f2-17a65c1e6fa5-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-21 16:09                                       ` Mike Snitzer
2018-05-21 16:09                                         ` Mike Snitzer
     [not found]                                         ` <20180521160907.GA19553-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-21 16:20                                           ` Jens Axboe
2018-05-21 16:20                                             ` Jens Axboe
     [not found]                                             ` <f9e3714c-b7c9-d5f6-4018-2a87dd5babb2-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>
2018-05-30 13:36                                               ` Mike Snitzer
2018-05-30 13:36                                                 ` Mike Snitzer
     [not found]                                                 ` <20180530133629.GC5157-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-30 18:55                                                   ` Jens Axboe
2018-05-30 18:55                                                     ` Jens Axboe
2018-05-30 19:34                                                     ` Kent Overstreet
2018-05-30 19:36                                                       ` Jens Axboe
2018-05-30 19:36                                                         ` Jens Axboe
2018-05-30 19:37                                                     ` Mike Snitzer
     [not found]                                                       ` <20180530193707.GB6568-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-05-30 19:38                                                         ` Jens Axboe
2018-05-30 19:38                                                           ` Jens Axboe
2018-05-21 17:37                                         ` Kent Overstreet
2018-05-21 18:24                                           ` Mike Snitzer
2018-05-21 18:24                                             ` Mike Snitzer
2018-05-21 23:38                                             ` Kent Overstreet
2018-05-22  6:41                                               ` Christoph Hellwig
     [not found]                                                 ` <20180522064118.GA18704-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2018-05-22 19:09                                                   ` Mike Snitzer [this message]
2018-05-22 19:09                                                     ` Mike Snitzer
2018-05-21 15:12       ` David Sterba
2018-05-21 15:18         ` Jens Axboe
2018-05-21 14:20 ` Jens Axboe
2018-05-30 22:24 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180522190933.GA25904@redhat.com \
    --to=snitzer-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org \
    --cc=bacik-b10kYP2dOMg@public.gmane.org \
    --cc=clm-b10kYP2dOMg@public.gmane.org \
    --cc=colyli-l3A5Bk7waGM@public.gmane.org \
    --cc=darrick.wong-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=drbd-dev-cunTk1MwBs8qoQakbn7OcQ@public.gmane.org \
    --cc=hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-btrfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-xfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=neilb-IBi9RG/b67k@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.