From: Matthew Wilcox <willy@infradead.org>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, songmuchun@bytedance.com,
mike.kravetz@oracle.com, david@redhat.com, nphamcs@gmail.com,
jthoughton@google.com
Subject: Re: [PATCH 2/2] mm/hugetlb: add wrapper functions for interactions with page cache
Date: Fri, 9 Jun 2023 21:10:23 +0100 [thread overview]
Message-ID: <ZIOHL1dtyoaR1S/w@casper.infradead.org> (raw)
In-Reply-To: <20230609194947.37196-3-sidhartha.kumar@oracle.com>
On Fri, Jun 09, 2023 at 12:49:47PM -0700, Sidhartha Kumar wrote:
> +++ b/fs/hugetlbfs/inode.c
> @@ -617,20 +617,19 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
> struct hstate *h = hstate_inode(inode);
> struct address_space *mapping = &inode->i_data;
> const pgoff_t start = lstart >> huge_page_shift(h);
> - const pgoff_t end = lend >> huge_page_shift(h);
> struct folio_batch fbatch;
> pgoff_t next, index;
> int i, freed = 0;
> bool truncate_op = (lend == LLONG_MAX);
>
> folio_batch_init(&fbatch);
> - next = start;
> - while (filemap_get_folios(mapping, &next, end - 1, &fbatch)) {
> + next = lstart;
That's suspicious. Surely it should be
next = lstart / PAGE_SIZE;
> + while (filemap_get_folios(mapping, &next, lend - 1, &fbatch)) {
and 'end' is supposed to be a pgoff_t, so lend - 1 is also suspicious.
> - index = folio->index;
> + index = (folio->index) >> huge_page_shift(h);
You don't need to use brackets here. While C's operator precedence is
legendarily confusing, the arrow operator binds far tighter than the
shift operator.
prev parent reply other threads:[~2023-06-09 20:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-09 19:49 [PATCH 0/2] change ->index to PAGE_SIZE for hugetlb pages Sidhartha Kumar
2023-06-09 19:49 ` [PATCH 1/2] mm/filemap: remove hugetlb special casing in filemap.c Sidhartha Kumar
2023-06-09 20:05 ` Matthew Wilcox
2023-06-09 20:18 ` Sidhartha Kumar
2023-06-15 22:13 ` Mike Kravetz
2023-06-09 19:49 ` [PATCH 2/2] mm/hugetlb: add wrapper functions for interactions with page cache Sidhartha Kumar
2023-06-09 19:52 ` Sidhartha Kumar
2023-06-15 23:36 ` Mike Kravetz
2023-06-16 18:52 ` Sidhartha Kumar
2023-06-16 23:41 ` Mike Kravetz
2023-06-09 20:10 ` Matthew Wilcox [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=ZIOHL1dtyoaR1S/w@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=jthoughton@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=nphamcs@gmail.com \
--cc=sidhartha.kumar@oracle.com \
--cc=songmuchun@bytedance.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 read-only IMAP folder(s) and NNTP newsgroup(s).