[PATCH RFC 14/29] mm/migrate: remove __ClearPageMovable()

David Hildenbrand posted 29 patches 3 months, 3 weeks ago
There is a newer version of this series
[PATCH RFC 14/29] mm/migrate: remove __ClearPageMovable()
Posted by David Hildenbrand 3 months, 3 weeks ago
Unused, let's remove it.

The Chinese docs in Documentation/translations/zh_CN/mm/page_migration.rst
still mention it, but that whole docs is destined to get outdated and
updated by somebody that actually speaks that language.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 include/linux/migrate.h |  4 ----
 mm/compaction.c         | 11 -----------
 2 files changed, 15 deletions(-)

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index c99a00d4ca27d..fb6e9612e9f0b 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -106,16 +106,12 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 #ifdef CONFIG_COMPACTION
 bool PageMovable(struct page *page);
 void __SetPageMovable(struct page *page, const struct movable_operations *ops);
-void __ClearPageMovable(struct page *page);
 #else
 static inline bool PageMovable(struct page *page) { return false; }
 static inline void __SetPageMovable(struct page *page,
 		const struct movable_operations *ops)
 {
 }
-static inline void __ClearPageMovable(struct page *page)
-{
-}
 #endif
 
 static inline
diff --git a/mm/compaction.c b/mm/compaction.c
index 17455c5a4be05..889ec696ba96a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -137,17 +137,6 @@ void __SetPageMovable(struct page *page, const struct movable_operations *mops)
 }
 EXPORT_SYMBOL(__SetPageMovable);
 
-void __ClearPageMovable(struct page *page)
-{
-	VM_BUG_ON_PAGE(!PageMovable(page), page);
-	/*
-	 * This page still has the type of a movable page, but it's
-	 * actually not movable any more.
-	 */
-	page->mapping = (void *)PAGE_MAPPING_MOVABLE;
-}
-EXPORT_SYMBOL(__ClearPageMovable);
-
 /* Do not skip compaction more than 64 times */
 #define COMPACT_MAX_DEFER_SHIFT 6
 
-- 
2.49.0
Re: [PATCH RFC 14/29] mm/migrate: remove __ClearPageMovable()
Posted by Zi Yan 3 months, 2 weeks ago
On 18 Jun 2025, at 13:39, David Hildenbrand wrote:

> Unused, let's remove it.
>
> The Chinese docs in Documentation/translations/zh_CN/mm/page_migration.rst
> still mention it, but that whole docs is destined to get outdated and
> updated by somebody that actually speaks that language.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
>  include/linux/migrate.h |  4 ----
>  mm/compaction.c         | 11 -----------
>  2 files changed, 15 deletions(-)
>

The comment for struct movable_operations needs an update too.
"
If page migration is successful, the driver should call
__ClearPageMovable(@src) and return MIGRATEPAGE_SUCCESS.
"

Otherwise, Reviewed-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi
Re: [PATCH RFC 14/29] mm/migrate: remove __ClearPageMovable()
Posted by David Hildenbrand 3 months, 2 weeks ago
On 20.06.25 22:15, Zi Yan wrote:
> On 18 Jun 2025, at 13:39, David Hildenbrand wrote:
> 
>> Unused, let's remove it.
>>
>> The Chinese docs in Documentation/translations/zh_CN/mm/page_migration.rst
>> still mention it, but that whole docs is destined to get outdated and
>> updated by somebody that actually speaks that language.
>>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   include/linux/migrate.h |  4 ----
>>   mm/compaction.c         | 11 -----------
>>   2 files changed, 15 deletions(-)
>>
> 
> The comment for struct movable_operations needs an update too.
> "
> If page migration is successful, the driver should call
> __ClearPageMovable(@src) and return MIGRATEPAGE_SUCCESS.
 > "

Ah, thanks, it will simply be "should return MIGRATEPAGE_SUCCESS".

There is more magic to it (the driver must setup the dst page as
movable), but probably that might all be reworked soon.

-- 
Cheers,

David / dhildenb