linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Chen Ridong <chenridong@huaweicloud.com>
Cc: akpm@linux-foundation.org, mhocko@suse.com,
	yosryahmed@google.com, yuzhao@google.com, david@redhat.com,
	willy@infradead.org, ryan.roberts@arm.com, baohua@kernel.org,
	21cnbao@gmail.com, wangkefeng.wang@huawei.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	chenridong@huawei.com, wangweiyang2@huawei.com,
	xieym_ict@hotmail.com
Subject: Re: [PATCH v7 mm-unstable] mm: vmscan: retry folios written back while isolated for traditional LRU
Date: Mon, 13 Jan 2025 10:52:06 -0500	[thread overview]
Message-ID: <20250113155206.GB829144@cmpxchg.org> (raw)
In-Reply-To: <20250111091504.1363075-1-chenridong@huaweicloud.com>

On Sat, Jan 11, 2025 at 09:15:04AM +0000, Chen Ridong wrote:
> @@ -5706,6 +5706,44 @@ static void lru_gen_shrink_node(struct pglist_data *pgdat, struct scan_control *
>  
>  #endif /* CONFIG_LRU_GEN */
>  
> +/**
> + * find_folios_written_back - Find and move the written back folios to a new list.
> + * @list: filios list
> + * @clean: the written back folios list
> + * @lruvec: the lruvec
> + * @type: LRU_GEN_ANON/LRU_GEN_FILE, only for multi-gen LRU
> + * @skip_retry: whether skip retry.
> + */
> +static inline void find_folios_written_back(struct list_head *list,
> +		struct list_head *clean, struct lruvec *lruvec, int type, bool skip_retry)
> +{
> +	struct folio *folio;
> +	struct folio *next;
> +
> +	list_for_each_entry_safe_reverse(folio, next, list, lru) {
> +#ifdef CONFIG_LRU_GEN
> +		DEFINE_MIN_SEQ(lruvec);
> +#endif
> +		if (!folio_evictable(folio)) {
> +			list_del(&folio->lru);
> +			folio_putback_lru(folio);
> +			continue;
> +		}
> +
> +		/* retry folios that may have missed folio_rotate_reclaimable() */
> +		if (!skip_retry && !folio_test_active(folio) && !folio_mapped(folio) &&
> +		    !folio_test_dirty(folio) && !folio_test_writeback(folio)) {
> +			list_move(&folio->lru, clean);
> +			continue;
> +		}
> +#ifdef CONFIG_LRU_GEN
> +		/* don't add rejected folios to the oldest generation */
> +		if (lru_gen_enabled() && lru_gen_folio_seq(lruvec, folio, false) == min_seq[type])
> +			set_mask_bits(&folio->flags, LRU_REFS_FLAGS, BIT(PG_active));
> +#endif
> +	}

Can't this solved much more easily by acting on the flag in the
generic LRU add/putback path? Instead of walking the list again.

Especially with Kirill's "[PATCH 0/8] mm: Remove PG_reclaim" that
removes the PG_readahead ambiguity.


  parent reply	other threads:[~2025-01-13 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11  9:15 Chen Ridong
2025-01-11 22:12 ` Yu Zhao
2025-01-13  8:35   ` chenridong
2025-01-13 15:52 ` Johannes Weiner [this message]
2025-01-15  3:59   ` Yu Zhao
2025-01-17 16:08     ` Johannes Weiner

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=20250113155206.GB829144@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=chenridong@huawei.com \
    --cc=chenridong@huaweicloud.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=ryan.roberts@arm.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=wangweiyang2@huawei.com \
    --cc=willy@infradead.org \
    --cc=xieym_ict@hotmail.com \
    --cc=yosryahmed@google.com \
    --cc=yuzhao@google.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