Subject: Re: linux-next: Tree for Aug 7 (mm/khugepaged.c)

From: Song Liu <[email-masked]>
Date: Wed, 7 Aug 2019 21:00:04 +0000

Hi Andrew,

> On Aug 7, 2019, at 1:10 PM, Andrew Morton <[email-masked]> wrote:
> 
> On Wed, 7 Aug 2019 16:59:14 +0000 Song Liu <[email-masked]> wrote:
> 
>> Hi Randy,
>> 
>>> On Aug 7, 2019, at 8:11 AM, Randy Dunlap <[email-masked]> wrote:
>>> 
>>> On 8/7/19 1:36 AM, Stephen Rothwell wrote:
>>>> Hi all,
>>>> 
>>>> Changes since 20190806:
>>>> 
>>> 
>>> on i386:
>>> 
>>> when CONFIG_SHMEM is not set/enabled:
>>> 
>>> ../mm/khugepaged.c: In function ‘khugepaged_scan_mm_slot’:
>>> ../mm/khugepaged.c:1874:2: error: implicit declaration of function ‘khugepaged_collapse_pte_mapped_thps’; did you mean ‘collapse_pte_mapped_thp’? [-Werror=implicit-function-declaration]
>>> khugepaged_collapse_pte_mapped_thps(mm_slot);
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 
>> Thanks for the report. 
>> 
>> Shall I resend the patch, or shall I send fix on top of current patch?
> 
> Either is OK.  If the difference is small I will turn it into an
> incremental patch so that I (and others) can see what changed.

Please find the patch to fix this at the end of this email. It applies 
right on top of "khugepaged: enable collapse pmd for pte-mapped THP". 
It may conflict a little with the "Enable THP for text section of 
non-shmem files" set, which renames function khugepaged_scan_shmem(). 

Also, I found v3 of the set in linux-next. The latest is v4:

https://lkml.org/lkml/2019/8/2/1587
https://lkml.org/lkml/2019/8/2/1588
https://lkml.org/lkml/2019/8/2/1589

Thanks,
Song

======== 8< ===========

From 26715c923f6cd283a2950cfd0a7cca483a3eb406 Mon Sep 17 00:00:00 2001
From: Song Liu <[email-masked]>
Date: Wed, 7 Aug 2019 10:21:30 -0700
Subject: [PATCH] khugepaged: fix build without CONFIG_SHMEM

Without CONFIG_SHMEM, we need dummy khugepaged_collapse_pte_mapped_thps.

Signed-off-by: Song Liu <[email-masked]>
---
 mm/khugepaged.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index ba36ff5c1d82..086323112c07 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1764,6 +1764,11 @@ static void khugepaged_scan_shmem(struct mm_struct *mm,
 {
        BUILD_BUG();
 }
+
+static int khugepaged_collapse_pte_mapped_thps(struct mm_slot *mm_slot)
+{
+       return 0;
+}
 #endif

 static unsigned int khugepaged_scan_mm_slot(unsigned int pages,
--
2.17.1