linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Ackerley Tng <ackerleytng@google.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	muchun.song@linux.dev, willy@infradead.org,
	sidhartha.kumar@oracle.com, jhubbard@nvidia.com,
	vannapurve@google.com, erdemaktas@google.com
Subject: Re: [PATCH] fs: hugetlbfs: Set vma policy only when needed for allocating folio
Date: Tue, 2 May 2023 20:11:54 -0700	[thread overview]
Message-ID: <20230503031154.GD3873@monkey> (raw)
In-Reply-To: <20230502235622.3652586-1-ackerleytng@google.com>

On 05/02/23 23:56, Ackerley Tng wrote:
> Calling hugetlb_set_vma_policy() later avoids setting the vma policy
> and then dropping it on a page cache hit.
> 
> Signed-off-by: Ackerley Tng <ackerleytng@google.com>
> ---
>  fs/hugetlbfs/inode.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

I suspect you noticed this when debugging the issue with using
page_cache_next_miss.  :)

Thanks!

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
-- 
Mike Kravetz

> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index f640cff1bbce..380b1cd6c93f 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -833,9 +833,6 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
>  			break;
>  		}
>  
> -		/* Set numa allocation policy based on index */
> -		hugetlb_set_vma_policy(&pseudo_vma, inode, index);
> -
>  		/* addr is the offset within the file (zero based) */
>  		addr = index * hpage_size;
>  
> @@ -846,7 +843,6 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
>  		/* See if already present in mapping to avoid alloc/free */
>  		if (filemap_has_folio(mapping, index)) {
>  			mutex_unlock(&hugetlb_fault_mutex_table[hash]);
> -			hugetlb_drop_vma_policy(&pseudo_vma);
>  			continue;
>  		}
>  
> @@ -858,6 +854,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
>  		 * folios in these areas, we need to consume the reserves
>  		 * to keep reservation accounting consistent.
>  		 */
> +		hugetlb_set_vma_policy(&pseudo_vma, inode, index);
>  		folio = alloc_hugetlb_folio(&pseudo_vma, addr, 0);
>  		hugetlb_drop_vma_policy(&pseudo_vma);
>  		if (IS_ERR(folio)) {
> -- 
> 2.40.1.495.gc816e09b53d-goog
> 


      reply	other threads:[~2023-05-03  3:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-02 23:56 Ackerley Tng
2023-05-03  3:11 ` 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=20230503031154.GD3873@monkey \
    --to=mike.kravetz@oracle.com \
    --cc=ackerleytng@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=erdemaktas@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=sidhartha.kumar@oracle.com \
    --cc=vannapurve@google.com \
    --cc=willy@infradead.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