Skip to content

Commit 4428a35

Browse files
ioworker0akpm00
authored andcommitted
mm/rmap: inline folio_test_large_maybe_mapped_shared() into callers
To prevent the function from being used when CONFIG_MM_ID is disabled, we intend to inline it into its few callers, which also would help maintain the expected code placement. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Lance Yang <[email protected]> Suggested-by: David Hildenbrand <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Mingzhe Yang <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent ee43f26 commit 4428a35

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

include/linux/mm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ static inline bool folio_maybe_mapped_shared(struct folio *folio)
21112111
*/
21122112
if (mapcount <= 1)
21132113
return false;
2114-
return folio_test_large_maybe_mapped_shared(folio);
2114+
return test_bit(FOLIO_MM_IDS_SHARED_BITNUM, &folio->_mm_ids);
21152115
}
21162116

21172117
#ifndef HAVE_ARCH_MAKE_FOLIO_ACCESSIBLE

include/linux/page-flags.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,10 +1230,6 @@ static inline int folio_has_private(const struct folio *folio)
12301230
return !!(folio->flags & PAGE_FLAGS_PRIVATE);
12311231
}
12321232

1233-
static inline bool folio_test_large_maybe_mapped_shared(const struct folio *folio)
1234-
{
1235-
return test_bit(FOLIO_MM_IDS_SHARED_BITNUM, &folio->_mm_ids);
1236-
}
12371233
#undef PF_ANY
12381234
#undef PF_HEAD
12391235
#undef PF_NO_TAIL

include/linux/rmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static inline void __folio_large_mapcount_sanity_checks(const struct folio *foli
223223
VM_WARN_ON_ONCE(folio_mm_id(folio, 1) != MM_ID_DUMMY &&
224224
folio->_mm_id_mapcount[1] < 0);
225225
VM_WARN_ON_ONCE(!folio_mapped(folio) &&
226-
folio_test_large_maybe_mapped_shared(folio));
226+
test_bit(FOLIO_MM_IDS_SHARED_BITNUM, &folio->_mm_ids));
227227
}
228228

229229
static __always_inline void folio_set_large_mapcount(struct folio *folio,

mm/memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3768,7 +3768,7 @@ static bool __wp_can_reuse_large_anon_folio(struct folio *folio,
37683768
* If all folio references are from mappings, and all mappings are in
37693769
* the page tables of this MM, then this folio is exclusive to this MM.
37703770
*/
3771-
if (folio_test_large_maybe_mapped_shared(folio))
3771+
if (test_bit(FOLIO_MM_IDS_SHARED_BITNUM, &folio->_mm_ids))
37723772
return false;
37733773

37743774
VM_WARN_ON_ONCE(folio_test_ksm(folio));
@@ -3791,7 +3791,7 @@ static bool __wp_can_reuse_large_anon_folio(struct folio *folio,
37913791
folio_lock_large_mapcount(folio);
37923792
VM_WARN_ON_ONCE_FOLIO(folio_large_mapcount(folio) > folio_ref_count(folio), folio);
37933793

3794-
if (folio_test_large_maybe_mapped_shared(folio))
3794+
if (test_bit(FOLIO_MM_IDS_SHARED_BITNUM, &folio->_mm_ids))
37953795
goto unlock;
37963796
if (folio_large_mapcount(folio) != folio_ref_count(folio))
37973797
goto unlock;

0 commit comments

Comments
 (0)