From: Mike Kravetz <mike.kravetz@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Muchun Song <muchun.song@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Sidhartha Kumar <sidhartha.kumar@oracle.com>,
linux-mm@kvack.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mm/hugetlb: fix hugetlbfs_pagecache_present()
Date: Mon, 3 Jul 2023 11:58:43 -0700 [thread overview]
Message-ID: <20230703185843.GC4378@monkey> (raw)
In-Reply-To: <efa86091-6a2c-4064-8f55-9b44e1313015@moroto.mountain>
On 06/23/23 09:26, Dan Carpenter wrote:
> The filemap_get_folio() function doesn't returns NULL, it returns error
> pointers. So the "return folio != NULL;" statement means
> hugetlbfs_pagecache_present() always returns true.
>
> Fixes: 267d6792f43b ("hugetlb: revert use of page_cache_next_miss()")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> mm/hugetlb.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index cb9077b96b43..bce28cca73a1 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5731,9 +5731,10 @@ static bool hugetlbfs_pagecache_present(struct hstate *h,
> struct folio *folio;
>
> folio = filemap_get_folio(mapping, idx);
> - if (!IS_ERR(folio))
> - folio_put(folio);
> - return folio != NULL;
> + if (IS_ERR(folio))
> + return false;
> + folio_put(folio);
> + return true;
> }
Thank you Dan!
I noted the changed behavior of filemap_get_folio in the commit message
and still missed that comparison to NULL. :(
--
Mike Kravetz
>
> int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping,
> --
> 2.39.2
>
prev parent reply other threads:[~2023-07-03 18:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 6:26 [PATCH] mm/hugetlb: fix hugetlbfs_pagecache_present() Dan Carpenter
2023-06-23 6:37 ` Sidhartha Kumar
2023-06-27 9:48 ` David Hildenbrand
2023-07-03 18:58 ` Mike Kravetz [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=20230703185843.GC4378@monkey \
--to=mike.kravetz@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=sidhartha.kumar@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.