From: William Kucharski <william.kucharski@oracle.com>
To: Yu Zhao <yuzhao@google.com>
Cc: Matthew Wilcox <willy@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Amir Goldstein <amir73il@gmail.com>,
Dave Chinner <david@fromorbit.com>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Souptick Joarder <jrdr.linux@gmail.com>,
Hugh Dickins <hughd@google.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/shmem: make find_get_pages_range() work for huge page
Date: Thu, 10 Jan 2019 04:43:57 -0700 [thread overview]
Message-ID: <A7BE64E0-8F88-46AC-A330-E1AB23A50073@oracle.com> (raw)
In-Reply-To: <20190110030838.84446-1-yuzhao@google.com>
> On Jan 9, 2019, at 8:08 PM, Yu Zhao <yuzhao@google.com> wrote:
>
> find_get_pages_range() and find_get_pages_range_tag() already
> correctly increment reference count on head when seeing compound
> page, but they may still use page index from tail. Page index
> from tail is always zero, so these functions don't work on huge
> shmem. This hasn't been a problem because, AFAIK, nobody calls
> these functions on (huge) shmem. Fix them anyway just in case.
>
> Signed-off-by: Yu Zhao <yuzhao@google.com>
> ---
> mm/filemap.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 81adec8ee02c..cf5fd773314a 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1704,7 +1704,7 @@ unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start,
>
> pages[ret] = page;
> if (++ret == nr_pages) {
> - *start = page->index + 1;
> + *start = xas.xa_index + 1;
> goto out;
> }
> continue;
> @@ -1850,7 +1850,7 @@ unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
>
> pages[ret] = page;
> if (++ret == nr_pages) {
> - *index = page->index + 1;
> + *index = xas.xa_index + 1;
> goto out;
> }
> continue;
> --
While this works, it seems like this would be more readable for future maintainers were it to
instead squirrel away the value for *start/*index when ret was zero on the first iteration through
the loop.
Though xa_index is designed to hold the first index of the entry, it seems inappropriate to have
these routines deference elements of xas directly; I guess it depends on how opaque we want to keep
xas and struct xa_state.
Does anyone else have a feeling one way or the other? I could be persuaded either way.
next prev parent reply other threads:[~2019-01-10 11:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 3:08 Yu Zhao
2019-01-10 11:43 ` William Kucharski [this message]
2019-02-12 23:57 ` Yu Zhao
2019-02-14 11:18 ` William Kucharski
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=A7BE64E0-8F88-46AC-A330-E1AB23A50073@oracle.com \
--to=william.kucharski@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=amir73il@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jrdr.linux@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
--cc=yuzhao@google.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