From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89152C43334 for ; Sat, 18 Jun 2022 04:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3i6us+0vaQB8z+t776eisC92Jf4IysRbo66Emye9nc4=; b=OXDTCHa70BcXoF OSNXFn1AeeDzwcHRG1GwlYxGAaoSpMCqNp4uJVrd74iCvrJGY9epxEAjehMwL04luiFGDyQcFFfLr SFH3dPb9+pSlUSnWxPKl7gQykEpjK8SJ1Rbwd7cw72crPoT3LANz4wDTwCWnC0Z9xXTEt7QUQkzFX TlT90MGTRn8UtazwUqiBYboUuKCWPxqVsH+fwicjM/WtIuryQu6kO80vNYU3T9+SaBrYo2PV3g96A BTxxZ0/3KbSARHKUXsAdr4QKpKYu5ysKUQnE9eCJCbzJF3/Jb0sUjdU6JcEwbT0PAWYK2wDIuUqpF 8RYTurqNtYSPGjN1fCMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Pu4-00AKrd-OV; Sat, 18 Jun 2022 04:17:44 +0000 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o2Pu0-00AKqs-TB for linux-arm-kernel@lists.infradead.org; Sat, 18 Jun 2022 04:17:43 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VGi26k0_1655525852; Received: from 30.13.184.185(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VGi26k0_1655525852) by smtp.aliyun-inc.com; Sat, 18 Jun 2022 12:17:33 +0800 Message-ID: <73715d55-288a-beb0-bb98-210a9233d25a@linux.alibaba.com> Date: Sat, 18 Jun 2022 12:17:41 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] arm64/hugetlb: Simplify the huge_ptep_set_access_flags() To: Catalin Marinas Cc: will@kernel.org, mike.kravetz@oracle.com, songmuchun@bytedance.com, anshuman.khandual@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: From: Baolin Wang In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220617_211741_189102_24CB2943 X-CRM114-Status: GOOD ( 14.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel