linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vishal Moola <vishal.moola@gmail.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH 6/7] khugepaged: Use a folio throughout collapse_file()
Date: Fri, 5 Apr 2024 14:20:28 -0700	[thread overview]
Message-ID: <ZhBrHNET9X5RiBuF@fedora> (raw)
In-Reply-To: <20240403171838.1445826-7-willy@infradead.org>

On Wed, Apr 03, 2024 at 06:18:35PM +0100, Matthew Wilcox (Oracle) wrote:
> @@ -1850,28 +1849,27 @@ static int collapse_file(struct mm_struct *mm, unsigned long addr,
>  				}
>  				/* drain lru cache to help isolate_lru_page() */
>  				lru_add_drain();
> -				page = folio_file_page(folio, index);
> -			} else if (trylock_page(page)) {
> -				get_page(page);
> +			} else if (folio_trylock(folio)) {
> +				folio_get(folio);
>  				xas_unlock_irq(&xas);
>  			} else {
>  				result = SCAN_PAGE_LOCK;
>  				goto xa_locked;
>  			}
>  		} else {	/* !is_shmem */
> -			if (!page || xa_is_value(page)) {
> +			if (!folio || xa_is_value(folio)) {
>  				xas_unlock_irq(&xas);
>  				page_cache_sync_readahead(mapping, &file->f_ra,
>  							  file, index,
>  							  end - index);
>  				/* drain lru cache to help isolate_lru_page() */
>  				lru_add_drain();
> -				page = find_lock_page(mapping, index);
> -				if (unlikely(page == NULL)) {
> +				folio = filemap_lock_folio(mapping, index);
> +				if (unlikely(folio == NULL)) {

filemap_lock_folio() can return an ERR_PTR(), find_lock_page() handles
it internally.

 


  reply	other threads:[~2024-04-05 21:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03 17:18 [PATCH 0/7] khugepaged folio conversions Matthew Wilcox (Oracle)
2024-04-03 17:18 ` [PATCH 1/7] khugepaged: Inline hpage_collapse_alloc_folio() Matthew Wilcox (Oracle)
2024-04-05 21:13   ` Vishal Moola
2024-04-03 17:18 ` [PATCH 2/7] khugepaged: Convert alloc_charge_hpage to alloc_charge_folio Matthew Wilcox (Oracle)
2024-04-05 21:14   ` Vishal Moola
2024-04-07  3:44     ` Matthew Wilcox
2024-04-03 17:18 ` [PATCH 3/7] khugepaged: Remove hpage from collapse_huge_page() Matthew Wilcox (Oracle)
2024-04-05 21:14   ` Vishal Moola
2024-04-03 17:18 ` [PATCH 4/7] khugepaged: Pass a folio to __collapse_huge_page_copy() Matthew Wilcox (Oracle)
2024-04-05 21:19   ` Vishal Moola
2024-04-07  3:46     ` Matthew Wilcox
2024-04-03 17:18 ` [PATCH 5/7] khugepaged: Remove hpage from collapse_file() Matthew Wilcox (Oracle)
2024-04-05 21:19   ` Vishal Moola
2024-04-03 17:18 ` [PATCH 6/7] khugepaged: Use a folio throughout collapse_file() Matthew Wilcox (Oracle)
2024-04-05 21:20   ` Vishal Moola [this message]
2024-04-07  3:43     ` Matthew Wilcox
2024-04-03 17:18 ` [PATCH 7/7] khugepaged: Use a folio throughout hpage_collapse_scan_file() Matthew Wilcox (Oracle)
2024-04-05 21:21   ` Vishal Moola
2024-04-08 20:07   ` David Hildenbrand
2024-04-08 20:28     ` Matthew Wilcox

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=ZhBrHNET9X5RiBuF@fedora \
    --to=vishal.moola@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --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