Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1479426

Re: [PATCH v2 1/5] blk-mq: abstract tag allocation out into scale_bitmap library

Path csiph.com!feeder.erje.net!1.us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Omar Sandoval <osandov@osandov.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/5] blk-mq: abstract tag allocation out into scale_bitmap library
Date Thu, 08 Sep 2016 20:20:02 +0200
Message-ID <sfc5A-OX-19@gated-at.bofh.it> (permalink)
References <seULn-6B3-3@gated-at.bofh.it> <seULo-6B3-11@gated-at.bofh.it> <seVxM-78e-21@gated-at.bofh.it> <seVxM-78e-19@gated-at.bofh.it> <sfc5A-OX-21@gated-at.bofh.it> <sfc5A-OX-23@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=drnvnOThF9iuZGte7CSB8N19/yemYt1GXjysYOxfWqg=; b=HGFx8bFS33APGdm79aPuU3u4BbMZdwAjtJ9n8ym1c+t86bJvjBXJtVms5NhPSaEfcm sC0jA4R4epFq71wk4docY+MfQAELwwunptn2O+ZH4OCZrcsvFjOtgvahSQgM3POsa6gu 3rzhHZYI5btxPb08VnajJSd6DLvax6Ru1NWb9IyAieZYQ7wE1IqC1XlNvbnjRIMqrVNp /DcI2svuTOvSYfIilzAGP2NM7wlYYARLQ1uQLAYdkXXJl/4CyOv0pPfDcGAY/5EvrGZN L5guKVJhA5xWZeS12b6OfgfNvMEgalMDZaPkRGtXetGWaJuDvTIKBsb9OMgc7K/AD1os 3ViA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=drnvnOThF9iuZGte7CSB8N19/yemYt1GXjysYOxfWqg=; b=HzmHpTAcfdgq1d19NdRZvmI0yU+6vd8X1eoCHC80nN99SdW2BWptdTu3LesLmpKaul SLSaSp/Fe0Fp1HWbPX6kG6zcYzNioBVtNebu9WEzsBkRiWEqg9/TKvR8AeW3g/nrvAVJ pm3pwUN7XPbu0VUEMzJhzSAdzOzFC+H1JeKd9/J0Jts1F6RboIb9fmioif9dKASgf3eB Ghqdi/Z+l515pRBU4ez9CLxfUwx7l3CNxRsAuWGMTmhvIA/zpJT2mh04u2dP9e6HXLaf Qi+Z+NMgzIRAXRsbAIryt5D7WkJebuwK46iPvLi5efBchnokjg2pFNyO6zbNEsjFZDgD gPEA==
X-Gm-Message-State AE9vXwP035Z2PI3GOXGioCM/pcb0TT5SyMasDpubHl6QKNdyVtqv9W4qGRFueffRk3FpGA1b
X-Received by 10.98.90.133 with SMTP id o127mr1691701pfb.61.1473358602308; Thu, 08 Sep 2016 11:16:42 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.7.0 (2016-08-17)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 96
Organization linux.* mail to news gateway
X-Original-Cc Alexei Starovoitov <ast@fb.com>, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com
X-Original-Date Thu, 8 Sep 2016 11:16:40 -0700
X-Original-Message-ID <20160908181640.GA30638@vader.DHCP.thefacebook.com>
X-Original-References <cover.1473291702.git.osandov@fb.com> <de3d08bb7b2a2f20bd456112b97a9ab2fe6f1573.1473291702.git.osandov@fb.com> <57D0AA74.5010000@fb.com> <20160908003859.GA31704@vader> <57D0BB13.30905@fb.com> <bee33eb9-9a92-c36c-ee0b-277a0263363c@fb.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1479426

Show key headers only | View raw


On Thu, Sep 08, 2016 at 10:11:58AM -0600, Jens Axboe wrote:
> On 09/07/2016 07:12 PM, Alexei Starovoitov wrote:
> > On 9/7/16 5:38 PM, Omar Sandoval wrote:
> > > On Wed, Sep 07, 2016 at 05:01:56PM -0700, Alexei Starovoitov wrote:
> > > > On 9/7/16 4:46 PM, Omar Sandoval wrote:
> > > > > From: Omar Sandoval <osandov@fb.com>
> > > > > 
> > > > > This is a generally useful data structure, so make it available to
> > > > > anyone else who might want to use it. It's also a nice cleanup
> > > > > separating the allocation logic from the rest of the tag handling
> > > > > logic.
> > > > > 
> > > > > The code is behind a new Kconfig option, CONFIG_SCALE_BITMAP, which is
> > > > > only selected by CONFIG_BLOCK for now.
> > > > > 
> > > > > This should be a complete noop functionality-wise.
> > > > > 
> > > > > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > > > > ---
> > > > >    MAINTAINERS                  |   1 +
> > > > >    block/Kconfig                |   1 +
> > > > >    block/blk-mq-tag.c           | 469
> > > > > ++++++++++---------------------------------
> > > > >    block/blk-mq-tag.h           |  37 +---
> > > > >    block/blk-mq.c               | 113 +++--------
> > > > >    block/blk-mq.h               |   9 -
> > > > >    include/linux/blk-mq.h       |   9 +-
> > > > >    include/linux/scale_bitmap.h | 340 +++++++++++++++++++++++++++++++
> > > > >    lib/Kconfig                  |   3 +
> > > > >    lib/Makefile                 |   2 +
> > > > >    lib/scale_bitmap.c           | 305 ++++++++++++++++++++++++++++
> > > > ...
> > > > > diff --git a/include/linux/scale_bitmap.h
> > > > > b/include/linux/scale_bitmap.h
> > > > > new file mode 100644
> > > > > index 0000000..63f712b
> > > > > --- /dev/null
> > > > > +++ b/include/linux/scale_bitmap.h
> > > > > @@ -0,0 +1,340 @@
> > > > > +/*
> > > > > + * Fast and scalable bitmaps.
> > > > ...
> > > > > +/**
> > > > > + * struct scale_bitmap_word - Word in a &struct scale_bitmap.
> > > > > + */
> > > > > +struct scale_bitmap_word {
> > > > > +/**
> > > > > + * struct scale_bitmap - Scalable bitmap.
> > > > > + *
> > > > > + * A &struct scale_bitmap is spread over multiple cachelines to
> > > > > avoid ping-pong.
> > > > > + * This trades off higher memory usage for better scalability.
> > > > > + */
> > > > > +struct scale_bitmap {
> > > > 
> > > > scale_bitmap sounds odd, since 'scale' is also a verb.
> > > > We also have lib/rhashtable.c:
> > > >   * Resizable, Scalable, Concurrent Hash Table
> > > > everything is 'scalable' nowadays.
> > > 
> > > Agreed, I'm not a huge fan of the name.
> > > 
> > > > May be resizable bitmap would be a better name?
> > > > 'struct rbitmap'... lib/rbitmap.c ?
> > > > 
> > > 
> > > Hm, the resizing operation isn't very well thought-out right now, it's
> > > there because it's okay for the way blk-mq uses it, but it's definitely
> > > not the point of the data structure. It's more of a cache-friendly
> > > bitmap, or a sparse bitmap. `struct sbitmap`? `struct cbitmap`?
> > 
> > yeah. naming is hard.
> > I think the name ideally should indicate how this bitmap
> > is different from array of bits that is already covered by
> > primitives in bitmap.h
> > Is it because the user can wait on the bit or because it's
> > smp aware? sort of percpu? I think that's the main trick how
> > it achieves good concurrent set/get access, right?
> > struct pcpu_bitmap ?
> > struct sbitmap is fine too.
> 
> It's not a true percpu bitmap. Rather it's a sparse bitmap, that
> provides some nice cache behavior through the nature of the sparseness.
> The percpu hinting helps with that. sbitmap might work, S for scale
> and/or sparse.
> 
> No name is going to convey what is special about it, but luckily Omar
> did a great job documenting it while pulling it out of blk-mq-tag. So
> I'm fine with just calling it sbitmap. I'll be pronouncing it like
> "spitmap".

"spitmap" it is :) I'll also do scale_bitmap_queue -> sbitmap_queue
unless anyone has a better idea.

-- 
Omar

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/5] blk-mq: abstract tag allocation out into scale_bitmap library Omar Sandoval <osandov@osandov.com> - 2016-09-08 01:50 +0200
  [PATCH v2 4/5] scale_bitmap: push alloc policy into scale_bitmap_queue Omar Sandoval <osandov@osandov.com> - 2016-09-08 01:50 +0200
  Re: [PATCH v2 1/5] blk-mq: abstract tag allocation out into  scale_bitmap library Omar Sandoval <osandov@osandov.com> - 2016-09-08 02:40 +0200
    Re: [PATCH v2 1/5] blk-mq: abstract tag allocation out into  scale_bitmap library Omar Sandoval <osandov@osandov.com> - 2016-09-08 20:20 +0200

csiph-web