lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALZtONDMMWX7ST_2DNijmAu3mJOmw21XTJZqNPD1wbZWBGjdew@mail.gmail.com>
Date:   Tue, 18 Oct 2016 09:57:53 -0400
From:   Dan Streetman <ddstreet@...e.org>
To:     zhongjiang <zhongjiang@...wei.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Dave Chinner <david@...morbit.com>,
        Vitaly Wool <vitalywool@...il.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Linux-MM <linux-mm@...ck.org>
Subject: Re: [PATCH] z3fold: limit first_num to the actual range of possible
 buddy indexes

On Tue, Oct 18, 2016 at 3:42 AM, zhongjiang <zhongjiang@...wei.com> wrote:
> From: zhong jiang <zhongjiang@...wei.com>
>
> At present, Tying the first_num size to NCHUNKS_ORDER is confusing.
> the number of chunks is completely unrelated to the number of buddies.
>
> The patch limit the first_num to actual range of possible buddy indexes.
> and that is more reasonable and obvious without functional change.
>
> Suggested-by: Dan Streetman <ddstreet@...e.org>
> Signed-off-by: zhong jiang <zhongjiang@...wei.com>

Acked-by: Dan Streetman <ddstreet@...e.org>

> --->  mm/z3fold.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 8f9e89c..207e5dd 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -50,7 +50,7 @@
>  #define ZHDR_SIZE_ALIGNED CHUNK_SIZE
>  #define NCHUNKS                ((PAGE_SIZE - ZHDR_SIZE_ALIGNED) >> CHUNK_SHIFT)
>
> -#define BUDDY_MASK     ((1 << NCHUNKS_ORDER) - 1)
> +#define BUDDY_MASK     (0x3)
>
>  struct z3fold_pool;
>  struct z3fold_ops {
> @@ -109,7 +109,7 @@ struct z3fold_header {
>         unsigned short middle_chunks;
>         unsigned short last_chunks;
>         unsigned short start_middle;
> -       unsigned short first_num:NCHUNKS_ORDER;
> +       unsigned short first_num:2;
>  };
>
>  /*
> @@ -179,7 +179,11 @@ static struct z3fold_header *handle_to_z3fold_header(unsigned long handle)
>         return (struct z3fold_header *)(handle & PAGE_MASK);
>  }
>
> -/* Returns buddy number */
> +/*
> + * (handle & BUDDY_MASK) < zhdr->first_num is possible in encode_handle
> + *  but that doesn't matter. because the masking will result in the
> + *  correct buddy number.
> + */
>  static enum buddy handle_to_buddy(unsigned long handle)
>  {
>         struct z3fold_header *zhdr = handle_to_z3fold_header(handle);
> --
> 1.8.3.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ