linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: zhouxianrong@huawei.com
Cc: linux-mm@kvack.org, hughd@google.com, aarcange@redhat.com,
	kirill.shutemov@linux.intel.com, dave.hansen@linux.intel.com,
	zhouchengming1@huawei.com, geliangtang@163.com,
	linux-kernel@vger.kernel.org, zhouxiyu@huawei.com,
	wanghaijun5@huawei.comHugh Dickins <hughd@google.com>
Subject: Re: [PATCH] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability.
Date: Tue, 14 Jun 2016 15:14:26 -0700	[thread overview]
Message-ID: <20160614151426.0e893a1f7b4e549a7c6e7fdf@linux-foundation.org> (raw)
In-Reply-To: <1465895857-1515-1-git-send-email-zhouxianrong@huawei.com>

On Tue, 14 Jun 2016 17:17:37 +0800 <zhouxianrong@huawei.com> wrote:

> From: z00281421 <z00281421@notesmail.huawei.com>
> 
> more mapcount page as kpage could reduce total replacement 
> times than fewer mapcount one when ksmd scan and replace 
> among forked pages later.
> 

Hopefully Hugh will be able to have a think about this.

> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -1094,6 +1094,21 @@ static struct page *try_to_merge_two_pages(struct rmap_item *rmap_item,
>  {
>  	int err;
>  
> +	/*
> +	 * select more mapcount page as kpage
> +	 */
> +	if (page_mapcount(page) < page_mapcount(tree_page)) {
> +		struct page *tmp_page;
> +		struct rmap_item *tmp_rmap_item;
> +
> +		tmp_page = page;
> +		page = tree_page;
> +		tree_page = tmp_page;
> +		tmp_rmap_item = rmap_item;
> +		rmap_item = tree_rmap_item;
> +		tree_rmap_item = tmp_rmap_item;
> +	}

kernel.h provides a swap() macro.

>  	err = try_to_merge_with_ksm_page(rmap_item, page, NULL);
>  	if (!err) {
>  		err = try_to_merge_with_ksm_page(tree_rmap_item,

--
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-06-14 22:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14  9:17 [PATCH] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability zhouxianrong
2016-06-14 22:14 ` Andrew Morton [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=20160614151426.0e893a1f7b4e549a7c6e7fdf@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aarcange@redhat.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=geliangtang@163.com \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wanghaijun5@huawei.comHugh \
    --cc=zhouchengming1@huawei.com \
    --cc=zhouxianrong@huawei.com \
    --cc=zhouxiyu@huawei.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).