* + mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch added to mm-unstable branch
@ 2024-03-11 19:29 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-03-11 19:29 UTC (permalink / raw)
To: mm-commits, ryan.roberts, willy, akpm
The patch titled
Subject: mm: remove folio from deferred split list before uncharging it
has been added to the -mm mm-unstable branch. Its filename is
mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: mm: remove folio from deferred split list before uncharging it
Date: Mon, 11 Mar 2024 19:18:34 +0000
When freeing a large folio, we must remove it from the deferred split list
before we uncharge it as each memcg has its own deferred split list (with
associated lock) and removing a folio from the deferred split list while
holding the wrong lock will corrupt that list and cause various related
problems.
Link: https://lore.kernel.org/linux-mm/367a14f7-340e-4b29-90ae-bc3fcefdd5f4@arm.com/
Link: https://lkml.kernel.org/r/20240311191835.312162-1-willy@infradead.org
Fixes: f77171d241e3 (mm: allow non-hugetlb large folios to be batch processed)
Fixes: 29f3843026cf (mm: free folios directly in move_folios_to_lru())
Fixes: bc2ff4cbc329 (mm: free folios in a batch in shrink_folio_list())
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Debugged-by: Ryan Roberts <ryan.roberts@arm.com>
Tested-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swap.c | 3 +++
mm/vmscan.c | 6 ++++++
2 files changed, 9 insertions(+)
--- a/mm/swap.c~mm-remove-folio-from-deferred-split-list-before-uncharging-it
+++ a/mm/swap.c
@@ -1012,6 +1012,9 @@ void folios_put_refs(struct folio_batch
free_huge_folio(folio);
continue;
}
+ if (folio_test_large(folio) &&
+ folio_test_large_rmappable(folio))
+ folio_undo_large_rmappable(folio);
__page_cache_release(folio, &lruvec, &flags);
--- a/mm/vmscan.c~mm-remove-folio-from-deferred-split-list-before-uncharging-it
+++ a/mm/vmscan.c
@@ -1413,6 +1413,9 @@ free_it:
*/
nr_reclaimed += nr_pages;
+ if (folio_test_large(folio) &&
+ folio_test_large_rmappable(folio))
+ folio_undo_large_rmappable(folio);
if (folio_batch_add(&free_folios, folio) == 0) {
mem_cgroup_uncharge_folios(&free_folios);
try_to_unmap_flush();
@@ -1819,6 +1822,9 @@ static unsigned int move_folios_to_lru(s
if (unlikely(folio_put_testzero(folio))) {
__folio_clear_lru_flags(folio);
+ if (folio_test_large(folio) &&
+ folio_test_large_rmappable(folio))
+ folio_undo_large_rmappable(folio);
if (folio_batch_add(&free_folios, folio) == 0) {
spin_unlock_irq(&lruvec->lru_lock);
mem_cgroup_uncharge_folios(&free_folios);
_
Patches currently in -mm which might be from willy@infradead.org are
mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
mm-fix-list-corruption-in-put_pages_list.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
* + mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch added to mm-unstable branch
@ 2024-03-11 18:28 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-03-11 18:28 UTC (permalink / raw)
To: mm-commits, ryan.roberts, willy, akpm
The patch titled
Subject: mm: remove folio from deferred split list before uncharging it
has been added to the -mm mm-unstable branch. Its filename is
mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
This patch will later appear in the mm-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days
------------------------------------------------------
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Subject: mm: remove folio from deferred split list before uncharging it
Date: Sun, 10 Mar 2024 13:48:48 +0000
When freeing a large folio, we must remove it from the deferred split list
before we uncharge it as each memcg has its own deferred split list (with
associated lock) and removing a folio from the deferred split list while
holding the wrong lock will corrupt that list and cause various related
problems.
Link: https://lore.kernel.org/linux-mm/367a14f7-340e-4b29-90ae-bc3fcefdd5f4@arm.com/
Link: https://lkml.kernel.org/r/20240310134850.3825782-1-willy@infradead.org
Fixes: f77171d241e3 (mm: allow non-hugetlb large folios to be batch processed)
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Debugged-by: Ryan Roberts <ryan.roberts@arm.com>
Tested-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/swap.c | 2 ++
1 file changed, 2 insertions(+)
--- a/mm/swap.c~mm-remove-folio-from-deferred-split-list-before-uncharging-it
+++ a/mm/swap.c
@@ -1012,6 +1012,8 @@ void folios_put_refs(struct folio_batch
free_huge_folio(folio);
continue;
}
+ if (folio_test_large(folio) && folio_test_large_rmappable(folio))
+ folio_undo_large_rmappable(folio);
__page_cache_release(folio, &lruvec, &flags);
_
Patches currently in -mm which might be from willy@infradead.org are
mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch
mm-fix-list-corruption-in-put_pages_list.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-11 19:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 19:29 + mm-remove-folio-from-deferred-split-list-before-uncharging-it.patch added to mm-unstable branch Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2024-03-11 18:28 Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.