summaryrefslogtreecommitdiff
path: root/mm/slab.c
diff options
context:
space:
mode:
authorVlastimil Babka <vbabka@suse.cz>2022-11-10 12:42:34 +0300
committerVlastimil Babka <vbabka@suse.cz>2022-11-21 12:36:09 +0300
commit76537db3b95cbf5d0189ce185c16db9f93017021 (patch)
treea09d81a797d52a9a64da0470ec25997b81d8499e /mm/slab.c
parent1c1aaa3319ab860883791edd2ba3e55610214c2e (diff)
parent130d4df57390a29521cb7cccd1b3144c184c111c (diff)
downloadlinux-76537db3b95cbf5d0189ce185c16db9f93017021.tar.xz
Merge branch 'slab/for-6.2/fit_rcu_head' into slab/for-next
A series by myself to reorder fields in struct slab to allow the embedded rcu_head to grow (for debugging purposes). Requires changes to isolate_movable_page() to skip slab pages which can otherwise become false-positive __PageMovable due to its use of low bits in page->mapping.
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c
index a9a6592e5e31..cbee5bbc6f11 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1370,6 +1370,8 @@ static struct slab *kmem_getpages(struct kmem_cache *cachep, gfp_t flags,
account_slab(slab, cachep->gfporder, cachep, flags);
__folio_set_slab(folio);
+ /* Make the flag visible before any changes to folio->mapping */
+ smp_wmb();
/* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */
if (sk_memalloc_socks() && page_is_pfmemalloc(folio_page(folio, 0)))
slab_set_pfmemalloc(slab);
@@ -1387,9 +1389,11 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab)
BUG_ON(!folio_test_slab(folio));
__slab_clear_pfmemalloc(slab);
- __folio_clear_slab(folio);
page_mapcount_reset(folio_page(folio, 0));
folio->mapping = NULL;
+ /* Make the mapping reset visible before clearing the flag */
+ smp_wmb();
+ __folio_clear_slab(folio);
if (current->reclaim_state)
current->reclaim_state->reclaimed_slab += 1 << order;