Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp685989iog; Fri, 17 Jun 2022 11:12:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vej1CiN0K4XNxLEco2O6eLTh6bCRjPz7BMOBYlleb6BS2iPFIRmYZJdotfv3wH6V4JwA4j X-Received: by 2002:a17:906:65c8:b0:713:ee3e:254d with SMTP id z8-20020a17090665c800b00713ee3e254dmr10639336ejn.0.1655489578761; Fri, 17 Jun 2022 11:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655489578; cv=none; d=google.com; s=arc-20160816; b=gmIj5QDbyhjMLuXn54YvP+MDa5Y/kTRoVsI/4IMu5bigGDCdHzkh8eatwCtRX/vVTI sghKvbdVHd/Y95eT2rnlj1jHQC+obJdAqPleG3mLMxiF2B37g+t/ugUFrdjjGN5yPgXh LO2rqTkimdAoP9N9PtdPeweAbIpwNr2a7SA6PR/oUsXWpWc6UPnlwAUquIGWbCZqoNbY EgZUf9IiDm6tCjoC4a5bDxNawad/zojM1ZrK47prM4caT9El/Z3VoLk/5mblQkv9t3Ic rFLX8qVQmBIg0otzhEJr248cT2ZWc1TMGCSLBhOwVDlE3R3unb6YpHp7B4ikvvesVd6f VALA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=NlJl9vY7pRGUdlZNsFa3aqLi+BSUQtJA2YvALHKl3Qk=; b=wXpJ9IIjeeiMIOGFgXoj6+5dYuLIUUS8BHewoK/zulKe0n/rs/rVDuT5Mf84f6BIId odvrwgAs9kbr3SaJEF1IXRkhooN2QOqx2Ov3WCzrx3HPJOjtjRp90azYotjJjHOgtpAe NjS4m/TwKRIZgO0Spb5orDHK0qD5SvWLxxYiYbRvdvcllOLoFto/IH3BdAqU8seu+EY+ G4p1Gd3a9BQSEfBwgwoJOELwH+AMlHuiDSkpRmAgSOzNdfdMi5awBJ7cepNIq7CQbWz9 vgCWGzN8r3MFZBPAfBbUq0HxmYTcLjAEMA+G+ZAnAk3qy+68DrhrrPPq9UWUCtnmNuYT 7sSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c10-20020a05640227ca00b0042dd79e606fsi3971205ede.478.2022.06.17.11.12.32; Fri, 17 Jun 2022 11:12:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383304AbiFQRqe (ORCPT + 99 others); Fri, 17 Jun 2022 13:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383268AbiFQRqa (ORCPT ); Fri, 17 Jun 2022 13:46:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39CDE42EF9 for ; Fri, 17 Jun 2022 10:46:29 -0700 (PDT) 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 BB18561F09 for ; 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: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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