Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Jan Kara <jack@suse.cz>, linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nadia Yvette Chambers <nyc@holomorphy.com>
Subject: Re: [PATCH 07/10] hugetlbfs: Use pagevec_lookup_range() in remove_inode_hugepages()
Date: Thu, 27 Jul 2017 12:10:34 -0700
Message-ID: <37d1740a-5ec4-1383-e862-a69ce6456353@oracle.com> (raw)
In-Reply-To: <20170726114704.7626-8-jack@suse.cz>

On 07/26/2017 04:47 AM, Jan Kara wrote:
> We want only pages from given range in remove_inode_hugepages(). Use
> pagevec_lookup_range() instead of pagevec_lookup().
> 
> CC: Nadia Yvette Chambers <nyc@holomorphy.com>
> Signed-off-by: Jan Kara <jack@suse.cz>

Nice.  I like the new interface.

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

> ---
>  fs/hugetlbfs/inode.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index b9678ce91e25..8931236f3ef4 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -403,7 +403,6 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
>  	struct pagevec pvec;
>  	pgoff_t next, index;
>  	int i, freed = 0;
> -	long lookup_nr = PAGEVEC_SIZE;
>  	bool truncate_op = (lend == LLONG_MAX);
>  
>  	memset(&pseudo_vma, 0, sizeof(struct vm_area_struct));
> @@ -412,30 +411,17 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
>  	next = start;
>  	while (next < end) {
>  		/*
> -		 * Don't grab more pages than the number left in the range.
> -		 */
> -		if (end - next < lookup_nr)
> -			lookup_nr = end - next;
> -
> -		/*
>  		 * When no more pages are found, we are done.
>  		 */
> -		if (!pagevec_lookup(&pvec, mapping, &next, lookup_nr))
> +		if (!pagevec_lookup_range(&pvec, mapping, &next, end - 1,
> +					  PAGEVEC_SIZE))
>  			break;
>  
>  		for (i = 0; i < pagevec_count(&pvec); ++i) {
>  			struct page *page = pvec.pages[i];
>  			u32 hash;
>  
> -			/*
> -			 * The page (index) could be beyond end.  This is
> -			 * only possible in the punch hole case as end is
> -			 * max page offset in the truncate case.
> -			 */
>  			index = page->index;
> -			if (index >= end)
> -				break;
> -
>  			hash = hugetlb_fault_mutex_hash(h, current->mm,
>  							&pseudo_vma,
>  							mapping, index, 0);
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-26 11:46 [PATCH 0/10 v2] Ranged pagevec lookup Jan Kara
2017-07-26 11:46 ` [PATCH 01/10] fscache: Remove unused ->now_uncached callback Jan Kara
2017-07-26 11:46 ` [PATCH 02/10] mm: Make pagevec_lookup() update index Jan Kara
2017-07-26 11:46 ` [PATCH 03/10] mm: Implement find_get_pages_range() Jan Kara
2017-07-26 11:46 ` [PATCH 04/10] fs: Fix performance regression in clean_bdev_aliases() Jan Kara
2017-07-26 11:46 ` [PATCH 05/10] ext4: Use pagevec_lookup_range() in ext4_find_unwritten_pgoff() Jan Kara
2017-07-26 11:47 ` [PATCH 06/10] ext4: Use pagevec_lookup_range() in writeback code Jan Kara
2017-07-26 11:47 ` [PATCH 07/10] hugetlbfs: Use pagevec_lookup_range() in remove_inode_hugepages() Jan Kara
2017-07-27 19:10   ` Mike Kravetz [this message]
2017-07-26 11:47 ` [PATCH 08/10] fs: Use pagevec_lookup_range() in page_cache_seek_hole_data() Jan Kara
2017-07-26 11:47 ` [PATCH 09/10] mm: Use find_get_pages_range() in filemap_range_has_page() Jan Kara
2017-07-26 11:47 ` [PATCH 10/10] mm: Remove nr_pages argument from pagevec_lookup{,_range}() Jan Kara

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=37d1740a-5ec4-1383-e862-a69ce6456353@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=nyc@holomorphy.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

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git