From: Andrew Morton <akpm@linux-foundation.org>
To: Hugh Dickins <hughd@google.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: Consistency of loops in mm/truncate.c?
Date: Mon, 23 May 2011 13:44:39 -0700 [thread overview]
Message-ID: <20110523134439.22582eee.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.LSU.2.00.1105221526020.17400@sister.anvils>
On Sun, 22 May 2011 15:27:41 -0700 (PDT)
Hugh Dickins <hughd@google.com> wrote:
> Andrew,
>
> I have a series aimed at 2.6.41 to remove mm/shmem.c's peculiar radix
> tree of swap entries, using slots in the file's standard radix_tree
> instead - prompted in part by https://lkml.org/lkml/2011/1/22/110
>
> There's a patch to give shmem its own truncation loop, handling pages
> and swap entries in the same pass. For that I want to start from a
> copy of truncate_inode_page_range(), but notice some discrepancies
> between the different loops in mm/truncate.c, so want to standardize
> them first before copying.
>
> The advancement of index is hard to follow: we rely upon page->index
> of an unlocked page persisting, yet we're ashamed of doing so, sometimes
> reading it again once locked. invalidate_mapping_pages() apologizes for
> this, but I think we should now just document that page->index is not
> modified until the page is freed.
That should be true under i_mutex and perhaps other external locking.
We could put some debug checks in there to catch any situation where
->index changed after the page was locked.
> invalidate_inode_pages2_range() has two sophistications not seen
> elsewhere, which 7afadfdc says were folded in by akpm (along with
> a page->index one):
>
> - Don't look up more pages than we're going to use:
> seems a good thing for me to fold into truncate_inode_pages_range()
> and invalidate_mapping_pages() too.
I guess so. I doubt if it makes a measurable performance difference
(except maybe in the case of small direct-io's?) but consistency is
good.
> - Check for the cursor wrapping at the end of the mapping:
> but with
>
> #if BITS_PER_LONG==32
> #define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
> #elif BITS_PER_LONG==64
> #define MAX_LFS_FILESIZE 0x7fffffffffffffffUL
> #endif
>
> I don't see how page->index + 1 would ever be 0, even if one or
> other of those "-1"s went away; so may I delete the "wrapped" case?
err yes, that seems bogus now and was bogus at the time. I never
trusted that s_maxbytes thing :)
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-05-23 20:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-22 22:27 Hugh Dickins
2011-05-23 20:22 ` Hugh Dickins
2011-05-23 20:44 ` Andrew Morton [this message]
2011-05-23 21:10 ` Hugh Dickins
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=20110523134439.22582eee.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--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