diff mbox series

[v3,14/14] mm/ksm: remove set_page_stable_node

Message ID 20240325124904.398913-15-alexs@kernel.org (mailing list archive)
State New
Headers show
Series transfer page to folio in KSM | expand

Commit Message

alexs@kernel.org March 25, 2024, 12:49 p.m. UTC
From: "Alex Shi (tencent)" <alexs@kernel.org>

Remove the func since all caller are gone. Also remove the
VM_BUG_ON_PAGE() because it's not applicable for a folio.

Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
To: linux-kernel@vger.kernel.org
To: linux-mm@kvack.org
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Chris Wright <chrisw@sous-sol.org>
---
 mm/ksm.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

David Hildenbrand April 5, 2024, 7:32 a.m. UTC | #1
On 25.03.24 13:49, alexs@kernel.org wrote:
> From: "Alex Shi (tencent)" <alexs@kernel.org>
> 
> Remove the func since all caller are gone. Also remove the
> VM_BUG_ON_PAGE() because it's not applicable for a folio.

Ehm, it is for small folios that we are working with here.

Please keep that check and convert it into a warn.

VM_WARN_ON_FOLIO(folio_test_anon(folio) && PageAnonExclusive(&folio->page), folio);

> -	page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
> -}
> -
>   static inline void folio_set_stable_node(struct folio *folio,
>   					 struct ksm_stable_node *stable_node)
>   {
> -	set_page_stable_node(&folio->page, stable_node);
> +	folio->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
>   }
>   
>   #ifdef CONFIG_SYSFS
David Hildenbrand April 5, 2024, 9:07 a.m. UTC | #2
On 25.03.24 13:49, alexs@kernel.org wrote:
> From: "Alex Shi (tencent)" <alexs@kernel.org>
> 
> Remove the func since all caller are gone. Also remove the
> VM_BUG_ON_PAGE() because it's not applicable for a folio.
> 
> Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
> To: linux-kernel@vger.kernel.org
> To: linux-mm@kvack.org
> To: Andrew Morton <akpm@linux-foundation.org>
> Cc: Izik Eidus <izik.eidus@ravellosystems.com>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Andrea Arcangeli <aarcange@redhat.com>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Chris Wright <chrisw@sous-sol.org>
> ---

Also, best to just squash this and #13.
Alex Shi April 8, 2024, 7 a.m. UTC | #3
On 4/5/24 3:32 PM, David Hildenbrand wrote:
> On 25.03.24 13:49, alexs@kernel.org wrote:
>> From: "Alex Shi (tencent)" <alexs@kernel.org>
>>
>> Remove the func since all caller are gone. Also remove the
>> VM_BUG_ON_PAGE() because it's not applicable for a folio.
> 
> Ehm, it is for small folios that we are working with here.
> 
> Please keep that check and convert it into a warn.
> 
> VM_WARN_ON_FOLIO(folio_test_anon(folio) && PageAnonExclusive(&folio->page), folio);

will take it. Thanks!

> 
>> -    page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
>> -}
>> -
>>   static inline void folio_set_stable_node(struct folio *folio,
>>                        struct ksm_stable_node *stable_node)
>>   {
>> -    set_page_stable_node(&folio->page, stable_node);
>> +    folio->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
>>   }
>>     #ifdef CONFIG_SYSFS
> 
>
Alex Shi April 8, 2024, 7:01 a.m. UTC | #4
On 4/5/24 5:07 PM, David Hildenbrand wrote:
> On 25.03.24 13:49, alexs@kernel.org wrote:
>> From: "Alex Shi (tencent)" <alexs@kernel.org>
>>
>> Remove the func since all caller are gone. Also remove the
>> VM_BUG_ON_PAGE() because it's not applicable for a folio.
>>
>> Signed-off-by: Alex Shi (tencent) <alexs@kernel.org>
>> To: linux-kernel@vger.kernel.org
>> To: linux-mm@kvack.org
>> To: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Izik Eidus <izik.eidus@ravellosystems.com>
>> Cc: Matthew Wilcox <willy@infradead.org>
>> Cc: Andrea Arcangeli <aarcange@redhat.com>
>> Cc: Hugh Dickins <hughd@google.com>
>> Cc: Chris Wright <chrisw@sous-sol.org>
>> ---
> 
> Also, best to just squash this and #13.

Sure, it's better merge them.
>
diff mbox series

Patch

diff --git a/mm/ksm.c b/mm/ksm.c
index d7c4cc4a0cc1..136909f0c5d5 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1094,17 +1094,10 @@  static inline struct ksm_stable_node *page_stable_node(struct page *page)
 	return folio_stable_node(page_folio(page));
 }
 
-static inline void set_page_stable_node(struct page *page,
-					struct ksm_stable_node *stable_node)
-{
-	VM_BUG_ON_PAGE(PageAnon(page) && PageAnonExclusive(page), page);
-	page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
-}
-
 static inline void folio_set_stable_node(struct folio *folio,
 					 struct ksm_stable_node *stable_node)
 {
-	set_page_stable_node(&folio->page, stable_node);
+	folio->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
 }
 
 #ifdef CONFIG_SYSFS