From: Barry Song <21cnbao@gmail.com>
To: a929244872@163.com
Cc: 21cnbao@gmail.com, akpm@linux-foundation.org, david@redhat.com,
fengbaopeng@honor.com, gaoxu2@honor.com, hailong.liu@oppo.com,
kaleshsingh@google.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, lokeshgidra@google.com, mhocko@suse.com,
minchan@kernel.org, ngeoffray@google.com, shli@fb.com,
surenb@google.com, v-songbaohua@oppo.com, yipengxiang@honor.com,
yuzhao@google.com
Subject: RE: [PATCH RFC] mm: mglru: provide a separate list for lazyfree anon folios
Date: Wed, 16 Oct 2024 15:54:30 +1300 [thread overview]
Message-ID: <20241016025430.4864-1-21cnbao@gmail.com> (raw)
In-Reply-To: <014f01db070a$61976220$24c62660$@163.com>
>> +++ b/include/linux/mmzone.h
>> @@ -434,7 +434,7 @@ struct lru_gen_folio {
>> /* the birth time of each generation in jiffies */
>> unsigned long timestamps[MAX_NR_GENS];
>> /* the multi-gen LRU lists, lazily sorted on eviction */
>> - struct list_head
>> folios[MAX_NR_GENS][ANON_AND_FILE][MAX_NR_ZONES];
>> + struct list_head folios[MAX_NR_GENS][ANON_AND_FILE +
>> 1][MAX_NR_ZONES];
> This also divides lazy free filio into MAX_NR_ZONES generations.
> The gen of a lazy free filio depends on the gen in the anno list before
> it is marked as lazy free. Whether it will happen that lazy free filios
> are released in an order that is not consistent with the order of the mark?
No, this separate list ensures that lazyfree folios are released in the
same order they were marked as lazyfree. Note that any newly marked
lazyfree folio is always placed in the most likely reclaimed
generation, regardless of the list.
static void lru_lazyfree(struct lruvec *lruvec, struct folio *folio)
{
long nr_pages = folio_nr_pages(folio);
if (!folio_test_anon(folio) || !folio_test_swapbacked(folio) ||
folio_test_swapcache(folio) || folio_test_unevictable(folio))
return;
lruvec_del_folio(lruvec, folio);
folio_clear_active(folio);
folio_clear_referenced(folio);
/*
* Lazyfree folios are clean anonymous folios. They have
* the swapbacked flag cleared, to distinguish them from normal
* anonymous folios
*/
folio_clear_swapbacked(folio);
lruvec_add_folio(lruvec, folio);
__count_vm_events(PGLAZYFREE, nr_pages);
__count_memcg_events(lruvec_memcg(lruvec), PGLAZYFREE, nr_pages);
}
Thanks
Barry
next prev parent reply other threads:[~2024-10-16 2:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-14 6:37 Barry Song
2024-09-15 0:58 ` wang wei
2024-10-16 2:54 ` Barry Song [this message]
2024-09-17 12:02 ` David Hildenbrand
2024-09-20 1:23 ` Barry Song
2024-09-23 22:19 ` Minchan Kim
2024-09-23 22:38 ` Barry Song
2024-09-24 20:12 ` Minchan Kim
2024-10-15 10:03 ` 回复: " gaoxu
2024-10-15 20:10 ` Barry Song
2024-10-16 1:25 ` 回复: " gaoxu
2024-09-18 6:19 ` gaoxu
2024-09-20 1:17 ` Barry Song
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=20241016025430.4864-1-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=a929244872@163.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=fengbaopeng@honor.com \
--cc=gaoxu2@honor.com \
--cc=hailong.liu@oppo.com \
--cc=kaleshsingh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lokeshgidra@google.com \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=ngeoffray@google.com \
--cc=shli@fb.com \
--cc=surenb@google.com \
--cc=v-songbaohua@oppo.com \
--cc=yipengxiang@honor.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