lkml.org 
[lkml]   [2022]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] arm64/hugetlb: Simplify the huge_ptep_set_access_flags()
From


On 6/18/2022 1:46 AM, Catalin Marinas wrote:
> On Wed, May 25, 2022 at 06:31:09PM +0800, Baolin Wang wrote:
>> After commit bc5dfb4fd7bd ("arm64/hugetlb: Implement arm64 specific
>> huge_ptep_get()"), the arm64 specific huge_ptep_get() will always
>> consider the subpages' dirty and young state for CONT-PTE/PMD hugetlb,
>> so there is no need to check them again when setting the access flags
>> for CONT-PTE/PMD hugetlb in huge_ptep_set_access_flags().
>>
>> Meanwhile this also fixes an issue when users want to make the CONT-PTE/PMD
>> hugetlb's pte entry old, which will be failed to make the pte entry old
>> since the original code will always consider the subpages' young state
>> if the subpages' young state is set. For example, we will make the
>> CONT-PTE/PMD hugetlb pte entry old in DAMON to monitoring the accesses,
>> but we'll failed to monitoring the actual accesses of the CONT-PTE/PMD
>> hugetlb page, due to we can not make its pte old.
>>
>> Thus remove the code considering the subpages' dirty and young state in
>> huge_ptep_set_access_flags() to fix this issue and simplify the function.
>
> The ptep_set_access_flags() semantics (non-huge) never clear the access
> flag, so mkold is not allowed. I think damon_hugetlb_mkold() is wrong in
> assuming that huge_ptep_set_access_flags() allows a young->old huge pte
> transition.

After reading the code carefully, yes, you are right. Seems I need
change to use set_huge_pte_at() to make the huge pte old. Thanks.

By the way, after changing to use set_huge_pte_at() in the
damon_hugetlb_mkold(), it seems to me that we still do not need to get
the subpages' dirty and young state again in
huge_ptep_set_access_flags(). How do you think?

\
 
 \ /
  Last update: 2022-06-18 06:18    [W:0.688 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site