linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Joonsoo Kim <js1304@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [RFC PATCH 3/3] mm/zsmalloc: change ZS_MAX_PAGES_PER_ZSPAGE
Date: Fri, 19 Feb 2016 14:55:07 +0900	[thread overview]
Message-ID: <20160219055507.GC16230@swordfish> (raw)
In-Reply-To: <20160219053814.GB16230@swordfish>

On (02/19/16 14:38), Sergey Senozhatsky wrote:
[..]
> #define OBJ_ALLOCATED_TAG 1
> #define OBJ_TAG_BITS 1
> #define OBJ_INDEX_BITS	(BITS_PER_LONG - _PFN_BITS - OBJ_TAG_BITS)
> #define OBJ_INDEX_MASK	((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
> 
> #define ZS_MIN_ALLOC_SIZE \
> 	MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
[..]

> -- on 32 bit system, PAGE_SHIFT 12
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (32 - (32 - 12) - 1)					11
> OBJ_INDEX_MASK ((1 << (32 - (32 - 12) - 1)) - 1)			2047
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 12 >> (32 - (32 - 12) - 1)))	32
> 
> -- on 64 bit system, PAGE_SHIFT 12
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (64 - (64 - 12) - 1)					11
> OBJ_INDEX_MASK ((1 << (64 - (64 - 12) - 1)) - 1)			2047
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 12 >> (64 - (64 - 12) - 1)))	32

even if it's missing  "HANDLE_PIN_BIT 0", it's still OBJ_INDEX_BITS 10,
2<<10 should be enough to keep 32 bytes class around.


> -- on 64 bit system, PAGE_SHIFT 14
> 
> ZS_MAX_PAGES_PER_ZSPAGE 1 << 4						16
> OBJ_INDEX_BITS (64 - (64 - 14) - 1)					13
> OBJ_INDEX_MASK ((1 << (64 - (64 - 14) - 1)) - 1)			8191
> ZS_MIN_ALLOC_SIZE MAX(32, ((1 << 4) << 14 >> (64 - (64 - 14) - 1)))	32

OBJ_INDEX_BITS 2<<12 still looks to be good enough.

	-ss

--
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-02-19  5:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  3:02 [RFC PATCH 0/3] mm/zsmalloc: increase density and reduce memory wastage Sergey Senozhatsky
2016-02-18  3:02 ` [RFC PATCH 1/3] mm/zsmalloc: introduce zs_get_huge_class_size_watermark() Sergey Senozhatsky
2016-02-18  3:02 ` [RFC PATCH 2/3] zram: use zs_get_huge_class_size_watermark() Sergey Senozhatsky
2016-02-18  3:02 ` [RFC PATCH 3/3] mm/zsmalloc: change ZS_MAX_PAGES_PER_ZSPAGE Sergey Senozhatsky
2016-02-18  4:41   ` Sergey Senozhatsky
2016-02-18  4:46     ` Sergey Senozhatsky
2016-02-18  5:03     ` Sergey Senozhatsky
2016-02-18  8:28   ` Joonsoo Kim
2016-02-18  9:55     ` Sergey Senozhatsky
2016-02-18 10:19       ` Sergey Senozhatsky
2016-02-19  1:19         ` Joonsoo Kim
2016-02-19  4:16           ` Sergey Senozhatsky
2016-02-19  4:19             ` Sergey Senozhatsky
2016-02-19  4:46             ` Sergey Senozhatsky
2016-02-19  5:38               ` Sergey Senozhatsky
2016-02-19  5:55                 ` Sergey Senozhatsky [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=20160219055507.GC16230@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky@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;
as well as URLs for NNTP newsgroup(s).