Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1556697
| Path | csiph.com!goblin1!goblin2!goblin.stu.neva.ru!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Dan Streetman <ddstreet@ieee.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH/RESEND v2 3/5] z3fold: extend compaction function |
| Date | Wed, 11 Jan 2017 17:30:02 +0100 |
| Message-ID | <sYtWG-In-35@gated-at.bofh.it> (permalink) |
| References | <sYsHf-8rV-15@gated-at.bofh.it> <sYsHf-8rV-35@gated-at.bofh.it> |
| X-Original-To | Vitaly Wool <vitalywool@gmail.com> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=15lduV+Z5X8xRn0lM2Rpn+wjl3sV51eSovFsPg4cQ2c=; b=AC03PVO93tZREw6PWS41yEH/zrd3B2HOl8jChuMxHJNoFj1T0Sx779mzxmcI2Q+VX6 iOTLGuKJ/2q50lN2+9qpo89pU/0kIdG0lG+YQP8CHSRopwJhg1prdNwYouvPEgOpKFcC PrVHq04sNuCE7MIzo6sErcRldYJH6sCreCyD6jtldDxAMKix5bHWfN9AR3SxMBmKT4Os f0qkucXrh9MxOZyEYJ89RPqOljjYSkrfO4MMwgKiL1fuaDFiJHyIOcbRZ2b6fa5rZcu/ Rz0N7IubkSCQDK59jWy+lJA+pdrJ+Jys6C/OH/bMeaheeRGYRFxgJbyNppUesFiQX8NQ Y+yg== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=15lduV+Z5X8xRn0lM2Rpn+wjl3sV51eSovFsPg4cQ2c=; b=Qm1A/SZd+cX9MkwgyNbL6FEg8zpKCfNEiEN/AbA6yb+mFU/g9+ZvWaaQZ/6vfBaBjr +Ne502I6HbW+GDYNQnodGvZZ8CDa+L+mVj7yiplYQKa/pyqQVmAtmTjwPEU5cmReyhSS qU7WwFrYQpPlM0R2p5Mc4zvD5oemb7VkAUn5n4VOCj6xEUjCbh/9SB17L/EejfzTAUbM E2PYyS4Vldav2hMwl43kTeAPmH/YznHim33Dyz63GnotanpwI56oq5VcyV5eAsVMmnQB fj4DzKfHI0JHQHYWbFJVKOd9ICRTMTq+ZunjgJn5PZtPhZeS4frrlZVyIiBmUs0vBJeW ww2Q== |
| X-Gm-Message-State | AIkVDXJ7pqpdmbMFW2Lo7GAvkRyz68/D2MvOcWRrXxkfatQffOUldoh3AQPg86ZmhBIjYLYqqnw7hUARdB52AQ== |
| X-Received | by 10.200.47.152 with SMTP id l24mr8850279qta.212.1484152168991; Wed, 11 Jan 2017 08:29:28 -0800 (PST) |
| MIME-Version | 1.0 |
| X-Google-Sender-Auth | cLVZ0zHLgjtXhzE4vFiNr9GKJIM |
| Content-Type | text/plain; charset=UTF-8 |
| 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 | 68 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Linux-MM <linux-mm@kvack.org>, linux-kernel <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org> |
| X-Original-Date | Wed, 11 Jan 2017 11:28:48 -0500 |
| X-Original-Message-ID | <CALZtONDmfWaJ2u-dO4BGnK0jztOGMEKb8WxEZ1iEurAdkMoxGA@mail.gmail.com> |
| X-Original-References | <20170111155948.aa61c5b995b6523caf87d862@gmail.com> <20170111160622.44ac261b12ed4778556c56dc@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1556697 |
Show key headers only | View raw
On Wed, Jan 11, 2017 at 10:06 AM, Vitaly Wool <vitalywool@gmail.com> wrote:
> z3fold_compact_page() currently only handles the situation when
> there's a single middle chunk within the z3fold page. However it
> may be worth it to move middle chunk closer to either first or
> last chunk, whichever is there, if the gap between them is big
> enough.
>
> This patch adds the relevant code, using BIG_CHUNK_GAP define as
> a threshold for middle chunk to be worth moving.
>
> Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
> ---
> mm/z3fold.c | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 98ab01f..fca3310 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -268,6 +268,7 @@ static inline void *mchunk_memmove(struct z3fold_header *zhdr,
> zhdr->middle_chunks << CHUNK_SHIFT);
> }
>
> +#define BIG_CHUNK_GAP 3
> /* Has to be called with lock held */
> static int z3fold_compact_page(struct z3fold_header *zhdr)
> {
> @@ -286,8 +287,31 @@ static int z3fold_compact_page(struct z3fold_header *zhdr)
> zhdr->middle_chunks = 0;
> zhdr->start_middle = 0;
> zhdr->first_num++;
> + return 1;
> }
> - return 1;
> +
> + /*
> + * moving data is expensive, so let's only do that if
> + * there's substantial gain (at least BIG_CHUNK_GAP chunks)
> + */
> + if (zhdr->first_chunks != 0 && zhdr->last_chunks == 0 &&
> + zhdr->start_middle - (zhdr->first_chunks + ZHDR_CHUNKS) >=
> + BIG_CHUNK_GAP) {
> + mchunk_memmove(zhdr, zhdr->first_chunks + 1);
> + zhdr->start_middle = zhdr->first_chunks + 1;
this should be first_chunks + ZHDR_CHUNKS, not + 1.
> + return 1;
> + } else if (zhdr->last_chunks != 0 && zhdr->first_chunks == 0 &&
> + TOTAL_CHUNKS - (zhdr->last_chunks + zhdr->start_middle
> + + zhdr->middle_chunks) >=
> + BIG_CHUNK_GAP) {
> + unsigned short new_start = NCHUNKS - zhdr->last_chunks -
this should be TOTAL_CHUNKS, not NCHUNKS.
> + zhdr->middle_chunks;
> + mchunk_memmove(zhdr, new_start);
> + zhdr->start_middle = new_start;
> + return 1;
> + }
> +
> + return 0;
> }
>
> /**
> --
> 2.4.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH/RESEND v2 3/5] z3fold: extend compaction function Vitaly Wool <vitalywool@gmail.com> - 2017-01-11 16:10 +0100
Re: [PATCH/RESEND v2 3/5] z3fold: extend compaction function Dan Streetman <ddstreet@ieee.org> - 2017-01-11 17:30 +0100
Re: [PATCH/RESEND v2 3/5] z3fold: extend compaction function Vitaly Wool <vitalywool@gmail.com> - 2017-01-11 17:50 +0100
Re: [PATCH/RESEND v2 3/5] z3fold: extend compaction function Vitaly Wool <vitalywool@gmail.com> - 2017-01-11 22:00 +0100
Re: [PATCH/RESEND v2 3/5] z3fold: extend compaction function Dan Streetman <ddstreet@ieee.org> - 2017-01-12 19:00 +0100
csiph-web