linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Streetman <ddstreet@ieee.org>
To: Vitaly Wool <vitalywool@gmail.com>
Cc: Linux-MM <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Seth Jennings <sjenning@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] z3fold: avoid modifying HEADLESS page and minor cleanup
Date: Fri, 27 May 2016 14:37:21 -0400	[thread overview]
Message-ID: <CALZtONDNTvaz4mDNuR7MQvdqMvisuD-COhfpyuztDTF=F9u8Uw@mail.gmail.com> (raw)
In-Reply-To: <5748706F.9020208@gmail.com>

On Fri, May 27, 2016 at 12:06 PM, Vitaly Wool <vitalywool@gmail.com> wrote:
> This patch fixes erroneous z3fold header access in a HEADLESS page
> in reclaim function, and changes one remaining direct
> handle-to-buddy conversion to use the appropriate helper.
>
> Signed-off-by: Vitaly Wool <vitalywool@gmail.com>

Reviewed-by: Dan Streetman <ddstreet@ieee.org>

> ---
>  mm/z3fold.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 34917d5..8f9e89c 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -412,7 +412,7 @@ static void z3fold_free(struct z3fold_pool *pool,
> unsigned long handle)
>                 /* HEADLESS page stored */
>                 bud = HEADLESS;
>         } else {
> -               bud = (handle - zhdr->first_num) & BUDDY_MASK;
> +               bud = handle_to_buddy(handle);
>                 switch (bud) {
>                 case FIRST:
> @@ -572,15 +572,19 @@ next:
>                         pool->pages_nr--;
>                         spin_unlock(&pool->lock);
>                         return 0;
> -               } else if (zhdr->first_chunks != 0 &&
> -                          zhdr->last_chunks != 0 && zhdr->middle_chunks !=
> 0) {
> -                       /* Full, add to buddied list */
> -                       list_add(&zhdr->buddy, &pool->buddied);
> -               } else if (!test_bit(PAGE_HEADLESS, &page->private)) {
> -                       z3fold_compact_page(zhdr);
> -                       /* add to unbuddied list */
> -                       freechunks = num_free_chunks(zhdr);
> -                       list_add(&zhdr->buddy,
> &pool->unbuddied[freechunks]);
> +               }  else if (!test_bit(PAGE_HEADLESS, &page->private)) {
> +                       if (zhdr->first_chunks != 0 &&
> +                           zhdr->last_chunks != 0 &&
> +                           zhdr->middle_chunks != 0) {
> +                               /* Full, add to buddied list */
> +                               list_add(&zhdr->buddy, &pool->buddied);
> +                       } else {
> +                               z3fold_compact_page(zhdr);
> +                               /* add to unbuddied list */
> +                               freechunks = num_free_chunks(zhdr);
> +                               list_add(&zhdr->buddy,
> +                                        &pool->unbuddied[freechunks]);
> +                       }
>                 }
>                 /* add to beginning of LRU */
> --
> 2.5.0
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2016-05-27 18:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-27 16:06 Vitaly Wool
2016-05-27 18:37 ` Dan Streetman [this message]

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='CALZtONDNTvaz4mDNuR7MQvdqMvisuD-COhfpyuztDTF=F9u8Uw@mail.gmail.com' \
    --to=ddstreet@ieee.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.com \
    --cc=vitalywool@gmail.com \
    /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