Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1230051

Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations

From Vitaly Wool <vitalywool@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations
Date 2015-09-22 12:20 +0200
Message-ID <qbsQ2-2oh-27@gated-at.bofh.it> (permalink)
References <q9jnQ-3nM-17@gated-at.bofh.it> <q9jxw-3z3-5@gated-at.bofh.it> <qbbYS-3k6-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] prepare zbud to be used by zram as underlying allocator Vitaly Wool <vitalywool@gmail.com> - 2015-09-16 13:50 +0200
  [PATCH 1/2] zbud: allow PAGE_SIZE allocations Vitaly Wool <vitalywool@gmail.com> - 2015-09-16 14:00 +0200
    Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Vlastimil Babka <vbabka@suse.cz> - 2015-09-17 15:10 +0200
      Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Vitaly Wool <vitalywool@gmail.com> - 2015-09-18 10:10 +0200
        Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Dan Streetman <ddstreet@ieee.org> - 2015-09-21 17:30 +0200
    Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Dan Streetman <ddstreet@ieee.org> - 2015-09-21 18:20 +0200
      Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Vitaly Wool <vitalywool@gmail.com> - 2015-09-22 12:20 +0200
        Re: [PATCH 1/2] zbud: allow PAGE_SIZE allocations Dan Streetman <ddstreet@ieee.org> - 2015-09-22 19:10 +0200
  [PATCH 2/2] zpool/zsmalloc/zbud: align on interfaces Vitaly Wool <vitalywool@gmail.com> - 2015-09-16 14:00 +0200
    Re: [PATCH 2/2] zpool/zsmalloc/zbud: align on interfaces Dan Streetman <ddstreet@ieee.org> - 2015-09-21 19:20 +0200
  Re: [PATCH 0/2] prepare zbud to be used by zram as underlying  allocator Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-09-17 03:30 +0200
    Re: [PATCH 0/2] prepare zbud to be used by zram as underlying allocator Vitaly Wool <vitalywool@gmail.com> - 2015-09-17 12:30 +0200
      Re: [PATCH 0/2] prepare zbud to be used by zram as underlying  allocator Minchan Kim <minchan@kernel.org> - 2015-09-21 06:20 +0200
        Re: [PATCH 0/2] prepare zbud to be used by zram as underlying allocator Vitaly Wool <vitalywool@gmail.com> - 2015-09-21 23:20 +0200
          Re: [PATCH 0/2] prepare zbud to be used by zram as underlying  allocator Minchan Kim <minchan@kernel.org> - 2015-09-22 17:40 +0200
            Re: [PATCH 0/2] prepare zbud to be used by zram as underlying  allocator Austin S Hemmelgarn <ahferroin7@gmail.com> - 2015-09-22 18:50 +0200

csiph-web