[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc08c0b4-84b3-5aa0-4c96-03f3767eec56@suse.cz>
Date: Thu, 26 Nov 2020 20:42:11 +0100
From: Vlastimil Babka <vbabka@...e.cz>
To: Rik van Riel <riel@...riel.com>, hughd@...gle.com
Cc: xuyu@...ux.alibaba.com, akpm@...ux-foundation.org, mgorman@...e.de,
aarcange@...hat.com, willy@...radead.org,
linux-kernel@...r.kernel.org, kernel-team@...com,
linux-mm@...ck.org, mhocko@...e.com
Subject: Re: [PATCH 3/3] mm,thp,shmem: make khugepaged obey tmpfs mount flags
On 11/26/20 7:14 PM, Rik van Riel wrote:
> On Thu, 2020-11-26 at 18:18 +0100, Vlastimil Babka wrote:
>> On 11/24/20 8:49 PM, Rik van Riel wrote:
>>> Currently if thp enabled=[madvise], mounting a tmpfs filesystem
>>> with huge=always and mmapping files from that tmpfs does not
>>> result in khugepaged collapsing those mappings, despite the
>>> mount flag indicating that it should.
>>>
>>> Fix that by breaking up the blocks of tests in hugepage_vma_check
>>> a little bit, and testing things in the correct order.
>>>
>>> Signed-off-by: Rik van Riel <riel@...riel.com>
>>> Fixes: c2231020ea7b ("mm: thp: register mm for khugepaged when
>>> merging vma for shmem")
>>
>> Looks ok. But, it we have sysfs thp enabled=never, and shmem mount
>> explicitly
>> thp enabled, then shmem mount overrides the global sysfs setting and
>> thp's will
>> be allocated there, right? However, khugepaged_enabled() will be
>> false and thus
>> khugepaged won't run at all? So a similar situation than what you're
>> fixing here.
>
> Indeed, that is somewhat similar. Whether or not shmem
> allocations attempt huge pages is controlled by both
> the file /sys/kernel/mm/transparent_hugepage/shmem_enabled
Ah right, there's also that sysfs file.
> and mount options.
>
> This patch makes khugepaged treat the mount options
> and/or
> sysfs flag as enabling collapsing of huge pages in case
> enabled = [always] for regular THPs.
>
> Should I send another patch on top
> of this that causes
> khugepaged to be enabled when regular THPs are disabled,
> but shmem THPs are enabled in any way?
I think it would make sense. Although it might involve counting
thp-enabled shmem mounts and only run khugepaged when there are >0 of them.
Powered by blists - more mailing lists