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 DA63FC4332F for ; Tue, 10 May 2022 15:55:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 706826B0071; Tue, 10 May 2022 11:55:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B5F16B0073; Tue, 10 May 2022 11:55:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 558836B0074; Tue, 10 May 2022 11:55:42 -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 48EAB6B0071 for ; Tue, 10 May 2022 11:55:42 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 1A63E121A19 for ; Tue, 10 May 2022 15:55:42 +0000 (UTC) X-FDA: 79450283724.20.2B03037 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf01.hostedemail.com (Postfix) with ESMTP id 5263E400AA for ; Tue, 10 May 2022 15:55:29 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id e24so16250846pjt.2 for ; Tue, 10 May 2022 08:55:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=j/4xO85+1iXeH6xPw7ga+S3tLZMTM08tKdS6+/P2WQoPLZQM3bma31auNvCGgMI7Ar XO54JRbZ5BtLRTQg9/0nD+wbZZ/55C/zxqc/YAIJJJTmE7iJm3kNHNbP9yBeloVN8Zry uc/GfhYhqfU6uvbPNHL1W6I3MnTtamWPUcml19joeVb3pcEE9qHUkwkGiymZbtR/EUbw 7zM3U6UcRRiqqxkbrNMb0yPIE4AZfU+p+ZP8jTC6T8+mEeCfPiKx59vtN21407Yfg/el O70YHEfHrJATZ8c9AdE6A5yPOFTwxIhhzAxHsq3X0laMczaHf3YHRcMS0o6j/IYotzTh prfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uzcCgVmhU+wESri3om0ZJezhJTbuZg70xEa5Aqfd+Kk=; b=SN0XPxFYBgCVU0QOSoFBJEUilT+G6/DYaycVOFvyCrkioOIlHYLVVJD/JYOBpkkoSq jgOQ+W27JEYKXm2EpE2zsi/N0cKVA/YNI+W2Qhf7ZOx2MK20t1emrZSRYuhMHki+Zdak ikZfYMq4q52BW07UYpksGdr4wn7wXsuBnR4JC+2NM+9HWPAnsErF1/8X47JaLtJHcYnN 1Lgfxs3GM5OYyQL5zVSjFXx5eYgFmRVv6vQhO5dhfSN3RdgLGagdOgfCdC/r8az1Brti SoTUJe8lEHCU+UVZI9An/+5Au+VV3+uqnjSyacNg5fMx0ECbUb0/kdCuZEModgTPeSa8 ma8Q== X-Gm-Message-State: AOAM532PuUPzHTpCPSA/h7+oYVhmBp31g8pYx1Oyibog0+6j6HDfm3cu KroPoeh7ZwatBJA9jowge+ciLw== X-Google-Smtp-Source: ABdhPJzDPZtZKtrakyoFjvKdG06+B3/wtrOXa/yfusBAvuf8/HUplk+3U/L9l/GLUCHmXlz3bAN82w== X-Received: by 2002:a17:90b:1e04:b0:1dc:9252:efbc with SMTP id pg4-20020a17090b1e0400b001dc9252efbcmr621215pjb.39.1652198139513; Tue, 10 May 2022 08:55:39 -0700 (PDT) Received: from localhost ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id x62-20020a623141000000b0050dc762819fsm10934700pfx.121.2022.05.10.08.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 08:55:39 -0700 (PDT) Date: Tue, 10 May 2022 23:55:36 +0800 From: Muchun Song To: Baolin Wang Cc: catalin.marinas@arm.com, will@kernel.org, mike.kravetz@oracle.com, akpm@linux-foundation.org, willy@infradead.org, anshuman.khandual@arm.com, christophe.leroy@csgroup.eu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] arm64/hugetlb: Use ptep_get() to get the pte value of a huge page Message-ID: References: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6aabddaf4cae5ae2205c3a7df9b9e15dbd61b641.1652180088.git.baolin.wang@linux.alibaba.com> X-Rspamd-Queue-Id: 5263E400AA X-Stat-Signature: pk7gm367schh4hriefrs6xyzxnn37mh6 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="j/4xO85+"; spf=pass (imf01.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam09 X-HE-Tag: 1652198129-20857 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 Tue, May 10, 2022 at 07:12:52PM +0800, Baolin Wang wrote: > The original huge_ptep_get() on ARM64 is just a wrapper of ptep_get(), > which will not take into account any contig-PTEs dirty and access bits. > Meanwhile we will implement a new ARM64-specific huge_ptep_get() > interface in following patch, which will take into account any contig-PTEs > dirty and access bits and only be allowed to pass the head pte of > a contig-PTE/PMD size page. IIUC, the huge_ptep_get() you have implemented in patch 2 could handle non-head pte. It'll return the original pte without potential AD bit. I admit it is more efficeent to use ptep_get() directly, but the judgement here should be updated. With this update. Reviewed-by: Muchun Song Thanks. > Thus change to use ptep_get() to get the pte value of a huge page as > a preparation. > > Signed-off-by: Baolin Wang > --- > arch/arm64/mm/hugetlbpage.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > index ca8e65c..be5e2f3 100644 > --- a/arch/arm64/mm/hugetlbpage.c > +++ b/arch/arm64/mm/hugetlbpage.c > @@ -172,7 +172,7 @@ static pte_t get_clear_flush(struct mm_struct *mm, > unsigned long pgsize, > unsigned long ncontig) > { > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > bool valid = pte_valid(orig_pte); > unsigned long i, saddr = addr; > > @@ -385,7 +385,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, > { > int ncontig; > size_t pgsize; > - pte_t orig_pte = huge_ptep_get(ptep); > + pte_t orig_pte = ptep_get(ptep); > > if (!pte_cont(orig_pte)) > return ptep_get_and_clear(mm, addr, ptep); > @@ -408,11 +408,11 @@ static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig) > { > int i; > > - if (pte_write(pte) != pte_write(huge_ptep_get(ptep))) > + if (pte_write(pte) != pte_write(ptep_get(ptep))) > return 1; > > for (i = 0; i < ncontig; i++) { > - pte_t orig_pte = huge_ptep_get(ptep + i); > + pte_t orig_pte = ptep_get(ptep + i); > > if (pte_dirty(pte) != pte_dirty(orig_pte)) > return 1; > -- > 1.8.3.1 > >