linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vitaly Wool <vitalywool@gmail.com>
To: Dan Streetman <ddstreet@ieee.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	Seth Jennings <sjennings@variantweb.net>
Subject: Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations
Date: Tue, 22 Sep 2015 12:18:58 +0200	[thread overview]
Message-ID: <CAMJBoFNGY2f3a7RV_y0buqF+dm23pXhUF=q6mTU3Bcj0AXF=LQ@mail.gmail.com> (raw)
In-Reply-To: <CALZtONCF6mSU1dKkv2bX+koM4LHciQ0TJciQx4k-PZzs8_mTNQ@mail.gmail.com>

Hi Dan,

On Mon, Sep 21, 2015 at 6:17 PM, Dan Streetman <ddstreet@ieee.org> wrote:
> Please make sure to cc Seth also, he's the owner of zbud.

Sure :)

<snip>
>> @@ -514,8 +552,17 @@ int zbud_reclaim_page(struct zbud_pool *pool, unsigned int retries)
>>                 return -EINVAL;
>>         }
>>         for (i = 0; i < retries; i++) {
>> -               zhdr = list_tail_entry(&pool->lru, struct zbud_header, lru);
>> -               list_del(&zhdr->lru);
>> +               page = list_tail_entry(&pool->lru, struct page, lru);
>> +               zhdr = page_address(page);
>> +               list_del(&page->lru);
>> +               /* Uncompressed zbud page? just run eviction and free it */
>> +               if (page->flags & PG_uncompressed) {
>> +                       page->flags &= ~PG_uncompressed;
>> +                       spin_unlock(&pool->lock);
>> +                       pool->ops->evict(pool, encode_handle(zhdr, FULL));
>> +                       __free_page(page);
>> +                       return 0;
>
> again, don't be redundant.  change the function to handle full-sized
> pages, don't repeat the function in an if() block for a special case.

Well, this case is a little tricky. How to process a zbud page in
zbud_reclaim_page() is defined basing on the assumption there is a
zhdr at the beginning of the page. What can be done here IMV is either
of the following:
* add a constant magic number to zhdr and check for it, if the check
fails, it is a type FULL page
* add a CRC field to zhdr, if CRC check over assumed zhdr fails,  it
is a type FULL page
* use a field from struct page to indicate its type

The last option still looks better to me.

~vitaly

--
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:[~2015-09-22 10:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 11:48 [PATCH 0/2] prepare zbud to be used by zram as underlying allocator Vitaly Wool
2015-09-16 11:50 ` [PATCH 1/2] zbud: allow PAGE_SIZE allocations Vitaly Wool
2015-09-17 13:00   ` Vlastimil Babka
2015-09-18  8:03     ` Vitaly Wool
2015-09-21 15:27       ` Dan Streetman
2015-09-21 16:17   ` Dan Streetman
2015-09-22 10:18     ` Vitaly Wool [this message]
2015-09-22 17:09       ` Dan Streetman
2015-09-16 11:53 ` [PATCH 2/2] zpool/zsmalloc/zbud: align on interfaces Vitaly Wool
2015-09-21 17:15   ` Dan Streetman
2015-09-17  1:30 ` [PATCH 0/2] prepare zbud to be used by zram as underlying allocator Sergey Senozhatsky
2015-09-17 10:26   ` Vitaly Wool
2015-09-21  4:18     ` Minchan Kim
2015-09-21 21:11       ` Vitaly Wool
2015-09-22 15:36         ` Minchan Kim
2015-09-22 16:49           ` Austin S Hemmelgarn

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='CAMJBoFNGY2f3a7RV_y0buqF+dm23pXhUF=q6mTU3Bcj0AXF=LQ@mail.gmail.com' \
    --to=vitalywool@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=sjennings@variantweb.net \
    /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