linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Wool <vitalywool@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: Dave Chinner <david@fromorbit.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: [PATCH v5] z3fold: add shrinker
Date: Tue, 18 Oct 2016 18:26:20 +0200	[thread overview]
Message-ID: <CAMJBoFNRFPYkcX05jZWjO21V9xzCipbBBtsq9CQbTU1EOK2hyg@mail.gmail.com> (raw)
In-Reply-To: <CALZtONCSBC+gxDHrCrQkyx0+eUwejLJJBvzsnPBtiKr58LJtLA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3710 bytes --]

18 окт. 2016 г. 18:29 пользователь "Dan Streetman" <ddstreet@ieee.org
<javascript:_e(%7B%7D,'cvml','ddstreet@ieee.org');>> написал:
>
> On Tue, Oct 18, 2016 at 10:51 AM, Vitaly Wool <vitalywool@gmail.com
<javascript:_e(%7B%7D,'cvml','vitalywool@gmail.com');>> wrote:
> > On Tue, Oct 18, 2016 at 4:27 PM, Dan Streetman <ddstreet@ieee.org
<javascript:_e(%7B%7D,'cvml','ddstreet@ieee.org');>> wrote:
> >> On Mon, Oct 17, 2016 at 10:45 PM, Vitaly Wool <vitalywool@gmail.com
<javascript:_e(%7B%7D,'cvml','vitalywool@gmail.com');>> wrote:
> >>> Hi Dan,
> >>>
> >>> On Tue, Oct 18, 2016 at 4:06 AM, Dan Streetman <ddstreet@ieee.org
<javascript:_e(%7B%7D,'cvml','ddstreet@ieee.org');>> wrote:
> >>>> On Sat, Oct 15, 2016 at 8:05 AM, Vitaly Wool <vitalywool@gmail.com
<javascript:_e(%7B%7D,'cvml','vitalywool@gmail.com');>> wrote:
> >>>>> This patch implements shrinker for z3fold. This shrinker
> >>>>> implementation does not free up any pages directly but it allows
> >>>>> for a denser placement of compressed objects which results in
> >>>>> less actual pages consumed and higher compression ratio therefore.
> >>>>>
> >>>>> This update removes z3fold page compaction from the freeing path
> >>>>> since we can rely on shrinker to do the job. Also, a new flag
> >>>>> UNDER_COMPACTION is introduced to protect against two threads
> >>>>> trying to compact the same page.
> >>>>
> >>>> i'm completely unconvinced that this should be a shrinker.  The
> >>>> alloc/free paths are much, much better suited to compacting a page
> >>>> than a shrinker that must scan through all the unbuddied pages.  Why
> >>>> not just improve compaction for the alloc/free paths?
> >>>
> >>> Basically the main reason is performance, I want to avoid compaction
on hot
> >>> paths as much as possible. This patchset brings both performance and
> >>> compression ratio gain, I'm not sure how to achieve that with
improving
> >>> compaction on alloc/free paths.
> >>
> >> It seems like a tradeoff of slight improvement in hot paths, for
> >> significant decrease in performance by adding a shrinker, which will
> >> do a lot of unnecessary scanning.  The alloc/free/unmap functions are
> >> working directly with the page at exactly the point where compaction
> >> is needed - when adding or removing a bud from the page.
> >
> > I can see that sometimes there are substantial amounts of pages that
> > are non-compactable synchronously due to the MIDDLE_CHUNK_MAPPED
> > bit set. Picking up those seems to be a good job for a shrinker, and
those
> > end up in the beginning of respective unbuddied lists, so the shrinker
is set
> > to find them. I can slightly optimize that by introducing a
> > COMPACT_DEFERRED flag or something like that to make shrinker find
> > those pages faster, would that make sense to you?
>
> Why not just compact the page in z3fold_unmap()?

That would give a huge performance penalty (checked).

> >> Sorry if I missed it in earlier emails, but have you done any
> >> performance measurements comparing with/without the shrinker?  The
> >> compression ratio gains may be possible with only the
> >> z3fold_compact_page() improvements, and performance may be stable (or
> >> better) with only a per-z3fold-page lock, instead of adding the
> >> shrinker...?
> >
> > I'm running some tests with per-page locks now, but according to the
> > previous measurements the shrinker version always wins on multi-core
> > platforms.
>
> But that comparison is without taking the spinlock in map/unmap right?

Right, but from the recent measurements it looks like per-page locks don't
slow things down that much.

~vitaly

[-- Attachment #2: Type: text/html, Size: 4869 bytes --]

  reply	other threads:[~2016-10-18 16:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 11:56 Vitaly Wool
2016-10-15 11:58 ` [PATCH v5 1/3] z3fold: make counters atomic Vitaly Wool
2016-10-17 20:37   ` Dan Streetman
2016-10-15 11:59 ` [PATCH v5 2/3] z3fold: remove redundant locking Vitaly Wool
2016-10-17 20:48   ` Dan Streetman
2016-10-18  2:55     ` Vitaly Wool
2016-10-15 12:05 ` [PATCH v5 3/3] z3fold: add shrinker Vitaly Wool
2016-10-18  2:06   ` Dan Streetman
2016-10-18  2:45     ` Vitaly Wool
2016-10-18 14:27       ` Dan Streetman
2016-10-18 14:51         ` Vitaly Wool
2016-10-18 15:29           ` Dan Streetman
2016-10-18 16:26             ` Vitaly Wool [this message]
2016-10-18 17:35               ` [PATCH v5] " Dan Streetman
2016-10-18 18:36                 ` Vitaly Wool

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=CAMJBoFNRFPYkcX05jZWjO21V9xzCipbBBtsq9CQbTU1EOK2hyg@mail.gmail.com \
    --to=vitalywool@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox