[PATCH 00/10] use folio in ksm

alexs@kernel.org posted 10 patches 1 year, 8 months ago
include/linux/mm.h |  17 ++++
mm/ksm.c           | 230 +++++++++++++++++++++++----------------------
2 files changed, 135 insertions(+), 112 deletions(-)
[PATCH 00/10] use folio in ksm
Posted by alexs@kernel.org 1 year, 8 months ago
From: "Alex Shi (tencent)" <alexs@kernel.org>

This is the 2nd part to use folio in ksm, it saves 82kbytes in ksm.o and
passed all ksm testcases in kselftest.

KSM still split same folios to single page if they are good to be KSM,
but will skip the rest subpage checking if a folio couldn't suit for
ksm.

Alex Shi (tencent) (10):
  mm/ksm: reduce the flush action for ksm merging page
  mm/ksm: skip subpages of compound pages
  mm/ksm: use folio in try_to_merge_one_page
  mm/ksm: add identical_folio func
  mm/ksm: use folio in stable_tree_search
  mm/ksm: remove page_stable_node
  mm/ksm: use folio in unstable_tree_search_insert
  mm/ksm: use folio in try_to_merge_xx serie funcs
  mm/ksm: calc_checksum for folio
  m/ksm: use folio in ksm scan path

 include/linux/mm.h |  17 ++++
 mm/ksm.c           | 230 +++++++++++++++++++++++----------------------
 2 files changed, 135 insertions(+), 112 deletions(-)

-- 
2.43.0
Re: [PATCH 00/10] use folio in ksm
Posted by David Hildenbrand 1 year, 8 months ago
On 04.06.24 06:24, alexs@kernel.org wrote:
> From: "Alex Shi (tencent)" <alexs@kernel.org>
> 
> This is the 2nd part to use folio in ksm, it saves 82kbytes in ksm.o and
> passed all ksm testcases in kselftest.
> 
> KSM still split same folios to single page if they are good to be KSM,
> but will skip the rest subpage checking if a folio couldn't suit for
> ksm.
> 
> Alex Shi (tencent) (10):
>    mm/ksm: reduce the flush action for ksm merging page
>    mm/ksm: skip subpages of compound pages
>    mm/ksm: use folio in try_to_merge_one_page
>    mm/ksm: add identical_folio func
>    mm/ksm: use folio in stable_tree_search
>    mm/ksm: remove page_stable_node
>    mm/ksm: use folio in unstable_tree_search_insert
>    mm/ksm: use folio in try_to_merge_xx serie funcs
>    mm/ksm: calc_checksum for folio
>    m/ksm: use folio in ksm scan path

I skimmed over most patches, but I'm afraid you introduce quite some 
subtle problems.

Part of the rework should not be do convert things to folios that really 
operate on pages (of possibly large folios).

We really have to be careful about pages vs. folios before we have KSM 
folios. Only then, we know that we have small folios only.

-- 
Cheers,

David / dhildenb
Re: [PATCH 00/10] use folio in ksm
Posted by Alex Shi 1 year, 8 months ago

On 6/4/24 9:28 PM, David Hildenbrand wrote:
> On 04.06.24 06:24, alexs@kernel.org wrote:
>> From: "Alex Shi (tencent)" <alexs@kernel.org>
>>
>> This is the 2nd part to use folio in ksm, it saves 82kbytes in ksm.o and
>> passed all ksm testcases in kselftest.
>>
>> KSM still split same folios to single page if they are good to be KSM,
>> but will skip the rest subpage checking if a folio couldn't suit for
>> ksm.
>>
>> Alex Shi (tencent) (10):
>>    mm/ksm: reduce the flush action for ksm merging page
>>    mm/ksm: skip subpages of compound pages
>>    mm/ksm: use folio in try_to_merge_one_page
>>    mm/ksm: add identical_folio func
>>    mm/ksm: use folio in stable_tree_search
>>    mm/ksm: remove page_stable_node
>>    mm/ksm: use folio in unstable_tree_search_insert
>>    mm/ksm: use folio in try_to_merge_xx serie funcs
>>    mm/ksm: calc_checksum for folio
>>    m/ksm: use folio in ksm scan path
> 
> I skimmed over most patches, but I'm afraid you introduce quite some subtle problems.
> 
> Part of the rework should not be do convert things to folios that really operate on pages (of possibly large folios).
> 
> We really have to be careful about pages vs. folios before we have KSM folios. Only then, we know that we have small folios only.
> 

Thanks a lot for your reviewing and comments. Let's if we'd do it better with your comments! :)

Thanks
Alex