linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Wool <vitalywool@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: zhongjiang <zhongjiang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Chinner <david@fromorbit.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH] z3fold: limit first_num to the actual range of possible buddy indexes
Date: Tue, 18 Oct 2016 16:54:48 +0200	[thread overview]
Message-ID: <CAMJBoFO3WAyrqDnEUGV2oHsPrGE+5+feMTegn5KaGxfC+Gm4Dw@mail.gmail.com> (raw)
In-Reply-To: <CALZtONDMMWX7ST_2DNijmAu3mJOmw21XTJZqNPD1wbZWBGjdew@mail.gmail.com>

On Tue, Oct 18, 2016 at 3:57 PM, Dan Streetman <ddstreet@ieee.org> wrote:
> On Tue, Oct 18, 2016 at 3:42 AM, zhongjiang <zhongjiang@huawei.com> wrote:
>> From: zhong jiang <zhongjiang@huawei.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@ieee.org>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>
> Acked-by: Dan Streetman <ddstreet@ieee.org>

Acked-by: Vitaly Wool <vitalywool@gmail.com>

>> --->  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
>>

--
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-10-18 14:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  7:42 zhongjiang
2016-10-18 13:57 ` Dan Streetman
2016-10-18 14:54   ` Vitaly Wool [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=CAMJBoFO3WAyrqDnEUGV2oHsPrGE+5+feMTegn5KaGxfC+Gm4Dw@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 \
    --cc=zhongjiang@huawei.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