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: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	linux-mm@kvack.org, 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: Thu, 18 Feb 2016 13:46:42 +0900	[thread overview]
Message-ID: <20160218044642.GB10776@swordfish> (raw)
In-Reply-To: <20160218044156.GA10776@swordfish>

On (02/18/16 13:41), Sergey Senozhatsky wrote:
> I think we better switch to different logic here -- specify how many ->huge
> classes we want to have, and let zsmalloc to calculate ZS_MAX_PAGES_PER_ZSPAGE.
> 
> 
> For example, if we want to have 20 ->huge classes, the 'smallest' (or the last)
							^^^ largest
> non-huge class will have CLASS_SIZE * SIZE_CLASS_DELTA of spare (wasted) space,
> so  PAGE_SIZE / (CLASS_SIZE * SIZE_CLASS_DELTA)  will give us the number of pages
> we need to form into a zspage to make it the last huge class.
						    ^^ 'non-huge'... what is the
						    correct english word I'm looking
						    for...

	-ss

> setting ZS_MIN_HUGE_CLASSES_NUM to 32 gives us (on x86_64, PAGE_SHIFT 12) ->huge
> class size range of [3648, 4096]. so all objects smaller than 3648 will not waste
> an entire zspage (and order-0 page), but will share the page with another objects
> of that size.
> 
> 
> something like this:
> 
> ---
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 0c9f117..d5252d1 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -73,12 +73,6 @@
>   */
>  #define ZS_ALIGN               8
>  
> -/*
> - * A single 'zspage' is composed of up ZS_MAX_PAGES_PER_ZSPAGE discontiguous
> - * 0-order (single) pages.
> - */
> -#define ZS_MAX_PAGES_PER_ZSPAGE        6
> -
>  #define ZS_HANDLE_SIZE (sizeof(unsigned long))
>  
>  /*
> @@ -149,6 +143,21 @@
>  #define ZS_SIZE_CLASS_DELTA    (PAGE_SIZE >> 8)
>  
>  /*
> + * We want to have at least this number of ->huge classes.
> + */
> +#define ZS_MIN_HUGE_CLASSES_NUM        32
> +/*
> + * A single 'zspage' is composed of up ZS_MAX_PAGES_PER_ZSPAGE discontiguous
> + * 0-order (single) pages.
> + *
> + * The smallest huge class will have CLASS_SIZE * SIZE_CLASS_DELTA of
> + * wasted space, calculate how many pages we need to fit a CLASS_SIZE
> + * object there and, thus, to save a additional zspage.
> + */
> +#define ZS_MAX_PAGES_PER_ZSPAGE        \
> +       (PAGE_SIZE / (ZS_MIN_HUGE_CLASSES_NUM * ZS_SIZE_CLASS_DELTA))
> +
> +/*
>   * We do not maintain any list for completely empty or full pages
>   */
>  enum fullness_group {
> 

--
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-18  4:45 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 [this message]
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

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=20160218044642.GB10776@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --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).