linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "zhaoyang.huang" <zhaoyang.huang@unisoc.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>, Yu Zhao <yuzhao@google.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	linux-mm@kvack.org, Zhaoyang Huang <huangzhaoyang@gmail.com>,
	steve.kang@unisoc.com
Subject: Re: [RFC PATCH 1/1] mm: Skip folio with private data during isolation
Date: Mon, 26 Aug 2024 12:36:08 +0200	[thread overview]
Message-ID: <38881e37-767c-456a-8301-2a7d0371d12e@redhat.com> (raw)
In-Reply-To: <20240826085056.895865-1-zhaoyang.huang@unisoc.com>

On 26.08.24 10:50, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> Since clean target folio with private data will be given up finally in
> __remove_mapping as it has extra refcnt, it is better to skip it during
> isolation to save the slot for more qualified folio. Current one could
> be the candidate for next round of scanning after the private data gone.
> 
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> ---
>   mm/vmscan.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index cfa839284b92..755bf3a387f3 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1685,6 +1685,8 @@ static unsigned long isolate_lru_folios(unsigned long nr_to_scan,
>   		 */
>   		scan += nr_pages;
>   
> +		if (folio_test_private(folio) && !folio_test_dirty(folio))
> +			goto move;
>   		if (!folio_test_lru(folio))
>   			goto move;
>   		if (!sc->may_unmap && folio_mapped(folio))

An earlier filemap_release_folio() would have failed if the private data 
(buffers) cannot get freed, and we went into the activate_locked path.


if (folio_needs_release(folio)) {
	if (!filemap_release_folio(folio, sc->gfp_mask)
		goto activate_locked;
...

if (folio_test_anon(folio) && !folio_test_swapbacked(folio)) {
	...
} else if (!mapping || !__remove_mapping(mapping, folio, true,
}

At least on the shrink_folio_list() path, I'm not sure the code you are 
adding could even trigger. We should not reach __remove_mapping() with 
folio_test_private().

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-08-26 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26  8:50 [RFC PATCH 1/1] mm: Skip folio with private data during isolation zhaoyang.huang
2024-08-26 10:36 ` David Hildenbrand [this message]
2024-08-26 11:10   ` Zhaoyang Huang
2024-08-26 13:01     ` David Hildenbrand
2024-08-27  2:45       ` Zhaoyang Huang
2024-08-27  2:49         ` Matthew Wilcox
2024-08-27  2:53           ` Zhaoyang Huang

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=38881e37-767c-456a-8301-2a7d0371d12e@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=huangzhaoyang@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=steve.kang@unisoc.com \
    --cc=willy@infradead.org \
    --cc=yuzhao@google.com \
    --cc=zhaoyang.huang@unisoc.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
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).