linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christopher Lameter <cl@linux.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Nadia Yvette Chambers <nyc@holomorphy.com>,
	Michal Hocko <mhocko@suse.com>, Jan Kara <jack@suse.cz>,
	Matthew Wilcox <willy@linux.intel.com>,
	Hugh Dickins <hughd@google.com>, Minchan Kim <minchan@kernel.org>,
	Shaohua Li <shli@fb.com>
Subject: Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page
Date: Mon, 7 Aug 2017 13:46:37 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.20.1708071343030.19915@nuc-kabylake> (raw)
In-Reply-To: <20170807072131.8343-1-ying.huang@intel.com>

On Mon, 7 Aug 2017, Huang, Ying wrote:

> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -4374,9 +4374,31 @@ void clear_huge_page(struct page *page,
>  	}
>
>  	might_sleep();
> -	for (i = 0; i < pages_per_huge_page; i++) {
> +	VM_BUG_ON(clamp(addr_hint, addr, addr +
> +			(pages_per_huge_page << PAGE_SHIFT)) != addr_hint);
> +	n = (addr_hint - addr) / PAGE_SIZE;
> +	if (2 * n <= pages_per_huge_page) {
> +		base = 0;
> +		l = n;
> +		for (i = pages_per_huge_page - 1; i >= 2 * n; i--) {
> +			cond_resched();
> +			clear_user_highpage(page + i, addr + i * PAGE_SIZE);
> +		}

I really like the idea behind the patch but this is not clearing from last
to first byte of the huge page.

What seems to be happening here is clearing from the last page to the
first page and I would think that within each page the clearing is from
first byte to last byte. Maybe more gains can be had by really clearing
from last to first byte of the huge page instead of this jumping over 4k
addresses?

  parent reply	other threads:[~2017-08-07 18:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-07  7:21 [PATCH -mm] mm: Clear to access sub-page last when clearing huge page Huang, Ying
2017-08-07  9:55 ` Jan Kara
2017-08-07 10:00   ` Huang, Ying
2017-08-07 10:16 ` Kirill A. Shutemov
2017-08-07 22:51   ` Huang, Ying
2017-08-08  7:40     ` Huang, Ying
2017-08-07 18:46 ` Christopher Lameter [this message]
2017-08-07 23:05   ` Huang, Ying
2017-08-08  6:26   ` Huang, Ying
2017-08-08  4:07 ` Mike Kravetz
2017-08-08  4:24   ` Huang, Ying
2017-08-08 12:12 ` Matthew Wilcox
2017-08-08 23:06   ` Huang, Ying
2017-08-09 21:25 ` Andrew Morton
2017-08-10  0:58   ` Huang, Ying

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=alpine.DEB.2.20.1708071343030.19915@nuc-kabylake \
    --to=cl@linux.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=nyc@holomorphy.com \
    --cc=shli@fb.com \
    --cc=willy@linux.intel.com \
    --cc=ying.huang@intel.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).