[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20160614151426.0e893a1f7b4e549a7c6e7fdf@linux-foundation.org>
Date: Tue, 14 Jun 2016 15:14:26 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: <zhouxianrong@...wei.com>
Cc: <linux-mm@...ck.org>, <hughd@...gle.com>, <aarcange@...hat.com>,
<kirill.shutemov@...ux.intel.com>, <dave.hansen@...ux.intel.com>,
<zhouchengming1@...wei.com>, <geliangtang@....com>,
<linux-kernel@...r.kernel.org>, <zhouxiyu@...wei.com>,
<wanghaijun5@...wei.com>, Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH] more mapcount page as kpage could reduce total
replacement times than fewer mapcount one in probability.
On Tue, 14 Jun 2016 17:17:37 +0800 <zhouxianrong@...wei.com> wrote:
> From: z00281421 <z00281421@...esmail.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,
Powered by blists - more mailing lists