linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
	Mike Kravetz <mike.kravetz@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] mm/hugetlb: fix hugetlbfs_pagecache_present()
Date: Thu, 22 Jun 2023 23:37:40 -0700	[thread overview]
Message-ID: <276ff3e9-2126-84d3-59d8-faffd06edd39@oracle.com> (raw)
In-Reply-To: <efa86091-6a2c-4064-8f55-9b44e1313015@moroto.mountain>

On 6/22/23 11:26 PM, 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;
>   }
>   
>   int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping,
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>


  reply	other threads:[~2023-06-23  6:37 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 [this message]
2023-06-27  9:48 ` David Hildenbrand
2023-07-03 18:58 ` Mike Kravetz

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=276ff3e9-2126-84d3-59d8-faffd06edd39@oracle.com \
    --to=sidhartha.kumar@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    /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).