From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Jan Kara <jack@suse.cz>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-mm@kvack.org
Subject: Re: Strange condition in invalidate_mapping_pages()
Date: Thu, 18 May 2017 18:28:20 +0300 [thread overview]
Message-ID: <20170518152820.4afcctrzzngcdxdz@node.shutemov.name> (raw)
In-Reply-To: <20170518132818.GA16430@quack2.suse.cz>
On Thu, May 18, 2017 at 03:28:18PM +0200, Jan Kara wrote:
> Hi Kirill,
>
> in commit fc127da085c26 "truncate: handle file thp" you've added the
> following to invalidate_mapping_pages():
>
> /* Middle of THP: skip */
> if (PageTransTail(page)) {
> unlock_page(page);
> continue;
> } else if (PageTransHuge(page)) {
> index += HPAGE_PMD_NR - 1;
> i += HPAGE_PMD_NR - 1;
> /* 'end' is in the middle of THP */
> if (index == round_down(end, HPAGE_PMD_NR))
> continue;
> }
>
> Now how can ever condition "if (index == round_down(end,
> HPAGE_PMD_NR))" be true? We have just added HPAGE_PMD_NR - 1 to 'index'
> so it will not be a multiple of HPAGE_PMD_NR. Presumably you wanted to
> check whether the current THP is the one containing 'end' here which would
> be something like 'round_down(index, HPAGE_PMD_NR) == round_down(end,
> HPAGE_PMD_NR)'.
You're right, it's a bug. 'page->index' instead of 'index' should do the
trick.
Would you like to prepare the patch? (I'm deep in 5-level paging at the
moment.)
> but then I still miss why you'd like to avoid invalidating the partial
> THP at the end of file... Can you please enlighten me? Thanks!
My logic was that the data in the non-invalidated part of the page can be
still useful and it's better to leave it in page cache.
I don't have performance numbers to validate my intuition.
--
Kirill A. Shutemov
--
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>
prev parent reply other threads:[~2017-05-18 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 13:28 Strange condition in invalidate_mapping_pages() Jan Kara
2017-05-18 15:28 ` Kirill A. Shutemov [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=20170518152820.4afcctrzzngcdxdz@node.shutemov.name \
--to=kirill@shutemov.name \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
/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).