linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 4/5] mm/vmscan: Convert shrink_active_list() to use a folio
Date: Mon, 11 Jul 2022 21:53:04 +0100	[thread overview]
Message-ID: <YsyNsP8Bz5BzGwtP@casper.infradead.org> (raw)
In-Reply-To: <20220617154248.700416-5-willy@infradead.org>

On Fri, Jun 17, 2022 at 04:42:47PM +0100, Matthew Wilcox (Oracle) wrote:
> @@ -2478,23 +2477,21 @@ static void shrink_active_list(unsigned long nr_to_scan,
>  
>  	while (!list_empty(&l_hold)) {
>  		struct folio *folio;
> -		struct page *page;
>  
>  		cond_resched();
>  		folio = lru_to_folio(&l_hold);
>  		list_del(&folio->lru);
> -		page = &folio->page;
>  
> -		if (unlikely(!page_evictable(page))) {
> -			putback_lru_page(page);
> +		if (unlikely(!folio_evictable(folio))) {
> +			folio_putback_lru(folio);
>  			continue;
>  		}
>  
>  		if (unlikely(buffer_heads_over_limit)) {
> -			if (page_has_private(page) && trylock_page(page)) {
> -				if (page_has_private(page))
> -					try_to_release_page(page, 0);
> -				unlock_page(page);
> +			if (folio_get_private(folio) && folio_trylock(folio)) {
> +				if (folio_get_private(folio))
> +					filemap_release_folio(folio, 0);
> +				folio_unlock(folio);
>  			}
>  		}
>  

Hi Andrew.  Hugh points out that the above is not an equivalent
transformation for pages which are in the swapcache.  Can you apply
this fix, or would you like a full patch?

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0070c7fb600a..7e34f4c8d956 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2544,8 +2544,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
 		}
 
 		if (unlikely(buffer_heads_over_limit)) {
-			if (folio_get_private(folio) && folio_trylock(folio)) {
-				if (folio_get_private(folio))
+			if (folio_test_private(folio) && folio_trylock(folio)) {
+				if (folio_test_private(folio))
 					filemap_release_folio(folio, 0);
 				folio_unlock(folio);
 			}


  parent reply	other threads:[~2022-07-11 20:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 15:42 [PATCH 0/5] Convert much of vmscan to folios Matthew Wilcox (Oracle)
2022-06-17 15:42 ` [PATCH 1/5] mm/vmscan: Convert reclaim_clean_pages_from_list() " Matthew Wilcox (Oracle)
2022-06-19  6:38   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 2/5] mm/vmscan: Convert isolate_lru_pages() to use a folio Matthew Wilcox (Oracle)
2022-06-19  6:39   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 3/5] mm/vmscan: Convert move_pages_to_lru() " Matthew Wilcox (Oracle)
2022-06-19  6:39   ` Christoph Hellwig
2022-06-17 15:42 ` [PATCH 4/5] mm/vmscan: Convert shrink_active_list() " Matthew Wilcox (Oracle)
2022-06-19  6:40   ` Christoph Hellwig
2022-07-11 20:53   ` Matthew Wilcox [this message]
2022-07-13 18:13     ` Andrew Morton
2022-06-17 15:42 ` [PATCH 5/5] mm/vmscan: Convert reclaim_pages() " Matthew Wilcox (Oracle)
2022-06-19  6:40   ` Christoph Hellwig

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=YsyNsP8Bz5BzGwtP@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-mm@kvack.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