linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bagas Sanjaya <bagasdotme@gmail.com>
To: xu xin <cgel.zte@gmail.com>
Cc: akpm@linux-foundation.org, adobriyan@gmail.com,
	willy@infradead.org, hughd@google.com,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, xu xin <xu.xin16@zte.com.cn>,
	Xiaokai Ran <ran.xiaokai@zte.com.cn>,
	Yang Yang <yang.yang29@zte.com.cn>
Subject: Re: [PATCH v2 1/2] ksm: count allocated ksm rmap_items for each process
Date: Wed, 24 Aug 2022 11:42:22 +0700	[thread overview]
Message-ID: <YwWsLqYbl20pYg8N@debian.me> (raw)
In-Reply-To: <20220824040153.215059-1-xu.xin16@zte.com.cn>

On Wed, Aug 24, 2022 at 04:01:53AM +0000, xu xin wrote:
> KSM can save memory by merging identical pages, but also can consume
> additional memory, because it needs to generate rmap_items to save
> each scanned page's brief rmap information. Some of these pages may
> be merged, but some may not be abled to be merged after being checked
> several times, which are unprofitable memory consumed.
> 
> The information about whether KSM save memory or consume memory in
> system-wide range can be determined by the comprehensive calculation
> of pages_sharing, pages_shared, pages_unshared and pages_volatile.
> A simple approximate calculation:
> 
> 	profit =~ pages_sharing * sizeof(page) - (all_rmap_items) *
> 	         sizeof(rmap_item);
> 
> where all_rmap_items equals to the sum of pages_sharing, pages_shared,
> pages_unshared and pages_volatile.
> 
> But we cannot calculate this kind of ksm profit inner single-process wide
> because the information of ksm rmap_item's number of a process is lacked.
> For user applications, if this kind of information could be obtained,
> it helps upper users know how beneficial the ksm-policy (like madvise)
> they are using brings, and then optimize their app code. For example,
> one application madvise 1000 pages as MERGEABLE, while only a few pages
> are really merged, then it's not cost-efficient.
> 
> So we add a new interface /proc/<pid>/ksm_rmp_items for each process to
> indicate the total allocated ksm rmap_items of this process. Similarly,
> we can calculate the ksm profit approximately for a single-process by:
> 
> 	profit =~ ksm_merging_pages * sizeof(page) - ksm_rmp_items *
> 		 sizeof(rmap_item);
> 
> where ksm_merging_pages and ksm_rmp_items are both under /proc/<pid>/.
> 

Hmm...

I can't apply this patch on linux-next. On what commit this patch series
is based on?

When submitting patches, don't forget to include --base to git
format-patch.

Thanks.

-- 
An old man doll... just what I always wanted! - Clara

  reply	other threads:[~2022-08-24  4:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24  4:00 [PATCH v2 0/2] ksm: count allocated rmap_items and update documentation xu xin
2022-08-24  4:01 ` [PATCH v2 1/2] ksm: count allocated ksm rmap_items for each process xu xin
2022-08-24  4:42   ` Bagas Sanjaya [this message]
2022-08-24  4:03 ` [PATCH v2 2/2] ksm: add profit monitoring documentation xu xin

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=YwWsLqYbl20pYg8N@debian.me \
    --to=bagasdotme@gmail.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgel.zte@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=willy@infradead.org \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    /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).