linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: linux-mm@kvack.org, Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	John Garry <john.garry@huawei.com>,
	linux-block@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC v2 PATCH] mm, sl[au]b: Introduce lockless cache
Date: Tue, 21 Sep 2021 17:17:02 +0100	[thread overview]
Message-ID: <YUoFfrQBmOdPEKpJ@casper.infradead.org> (raw)
In-Reply-To: <20210921154239.GA5092@kvm.asia-northeast3-a.c.our-ratio-313919.internal>

On Tue, Sep 21, 2021 at 03:42:39PM +0000, Hyeonggon Yoo wrote:
> > > +	/* slowpath */
> > > +	cache->size = kmem_cache_alloc_bulk(s, gfpflags,
> > > +			KMEM_LOCKLESS_CACHE_QUEUE_SIZE, cache->queue);
> > 
> > Go back to the Bonwick paper and look at the magazine section again.
> > You have to allocate _half_ the size of the queue, otherwise you get
> > into pathological situations where you start to free and allocate
> > every time.
> 
> I want to ask you where idea of allocating 'half' the size of queue came from.
> the paper you sent does not work with single queue(magazine). Instead,
> it manages pool of magazines.
> 
> And after reading the paper, I see managing pool of magazine (where M is
> an boot parameter) is valid approach to reduce hitting slowpath.

Bonwick uses two magazines per cpu; if both are empty, one is replaced
with a full one.  If both are full, one is replaced with an empty one.
Our slab implementation doesn't provide magazine allocation, but it does
provide bulk allocation.  So translating the Bonwick implementation to
our implementation, we need to bulk-allocate or bulk-free half of the
array at any time.

  reply	other threads:[~2021-09-21 16:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 15:48 Hyeonggon Yoo
2021-09-20 22:01 ` Matthew Wilcox
2021-09-21 10:56   ` Hyeonggon Yoo
2021-09-21 15:42   ` Hyeonggon Yoo
2021-09-21 16:17     ` Matthew Wilcox [this message]
2021-09-22  8:32       ` Hyeonggon Yoo
2021-09-22  9:11         ` Hyeonggon Yoo
2021-09-21 15:37 ` Jens Axboe
2021-09-22  8:19   ` Hyeonggon Yoo
2021-09-22 12:58     ` Jens Axboe
2021-09-23  3:34       ` Hyeonggon Yoo
2021-09-23 13:28       ` Jakub Kicinski
2021-09-23  3:55 ` Github link here Hyeonggon Yoo

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=YUoFfrQBmOdPEKpJ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --subject='Re: [RFC v2 PATCH] mm, sl[au]b: Introduce lockless cache' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).