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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA804C433EF for ; Fri, 17 Jun 2022 17:46:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 65B186B0071; Fri, 17 Jun 2022 13:46:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E4566B0073; Fri, 17 Jun 2022 13:46:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 485FF6B0074; Fri, 17 Jun 2022 13:46:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 36FE06B0071 for ; Fri, 17 Jun 2022 13:46:33 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 10DA820705 for ; Fri, 17 Jun 2022 17:46:33 +0000 (UTC) X-FDA: 79588457466.31.8259DA0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf21.hostedemail.com (Postfix) with ESMTP id 96E481C00B2 for ; Fri, 17 Jun 2022 17:46:32 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB16C61DD9; Fri, 17 Jun 2022 17:46:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94DD3C3411B; Fri, 17 Jun 2022 17:46:26 +0000 (UTC) Date: Fri, 17 Jun 2022 18:46:22 +0100 From: Catalin Marinas To: Baolin Wang 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 Subject: Re: [PATCH] arm64/hugetlb: Simplify the huge_ptep_set_access_flags() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655487992; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NlJl9vY7pRGUdlZNsFa3aqLi+BSUQtJA2YvALHKl3Qk=; b=Ud4cc0rqauEpCQSd8qgkMbtNy/043ZbcAjv4PBEY1vQp9KLN1J30L7c8Aps2Vy5fAA5iIE pAYHivXS9lTM8gSR2lv82P9DNY8VWNzrjqv3UDiUR+PUU2OyzoODl5049iFDc4uVsTpEIP vJxQfnoKoSgXXFfMs8lvl9gSTxVOHKo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655487992; a=rsa-sha256; cv=none; b=7lqkQnKuaOfZrIEtf3NHue0gkHfUnu694wG5tpBoILRuRuVPcZqdRWjVQBCAj/gaTNvV05 5FM7y2A5iDgpQNI/+aFSRKpvPzyd/ijNTt/gHpZXWVYotEKpBqp5PmiEVAMOfJLZZ80gdq Q5p5p/3mfbz1DX2vldn0cqT8anvMBTI= X-Stat-Signature: 8r193perzsbhf6ndcuaf81s5z1mcbxuj X-Rspamd-Queue-Id: 96E481C00B2 X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none) X-HE-Tag: 1655487992-76420 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. -- Catalin