Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp143007rwb; Thu, 18 Aug 2022 00:51:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR50Q/kV1xC0GlHVXmdUQihOlrO/9WFcFZLTiAa7n+XDU/bEOpmT1dVqGd1aIBm3oOVwtozI X-Received: by 2002:a63:6b02:0:b0:422:7cf8:4bf with SMTP id g2-20020a636b02000000b004227cf804bfmr1633766pgc.92.1660809063772; Thu, 18 Aug 2022 00:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660809063; cv=none; d=google.com; s=arc-20160816; b=o7cb8UECCx0RTcwvMGGlh2Y0HMoyxTlWZW7QxUUnAnazAc+9hACavp4MoQcXxcEZuG T6v6zKPBQynqzJOOZsB6YqwaGUoEjZANOE06fT2O7Rd2MArKrq5lyymguxxBH3oMvMOe SKRUyv+t/ei6sBM6pI2shHu4RYJvTIFy93gFPGSgJ7RiNQF90Ju8O/mknxGivftl/MSE MVOP3kMtYeR0fk9ckFe9PcuVvEPAxylP2Og0NaUU51rlRMbZkT03srLYAE1YSnePGjYB qFcTDjWKgS6vs0Orb8WjCYOFkrZzAM0CZA7J7M7KroMmNxbiNL9DfBp27x5ZxiFlRAw3 xBtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=BkiOjvkX2Q1q3IodZ187oXTbyBghZMkV8guJAgduYcw=; b=mA8Vis5e+Dm+VTZY5K8fEKY2Lo9mbN6P4XXtlk7A4cAhdfyfcp3+IC0Tg0LmtCuwGU cBkV7tn6/+tZq15SduHKxtIX/hQXK1PjVk3f0D5Oytkjubb8oKNjCt2V3EGQe0x7nuuX ukFzdivPF7HvNrsU2lPdTMpWwLImTonNyRD/hJGXjZxWjsglqnvTtlmSWUTSHUxDrOXh K6OVKc5aoz7Yqoy85rav1MDu4SVvehvOXO09y6QtGYSSR69/lal8xzde461voeMa8Ykl ZA3FPW1I3VCAdcmLNVdixNFSo/ixXLVqLTzsIAyk1DYakO1M9h0A8gf8wEg2M0CNu4pu TMEA== 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=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id az16-20020a17090b029000b001f7299d9c0fsi921636pjb.59.2022.08.18.00.50.52; Thu, 18 Aug 2022 00:51:03 -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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243591AbiHRHiG (ORCPT + 99 others); Thu, 18 Aug 2022 03:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243740AbiHRHiE (ORCPT ); Thu, 18 Aug 2022 03:38:04 -0400 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 755AEA261B for ; Thu, 18 Aug 2022 00:38:02 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VMZnOiw_1660808276; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VMZnOiw_1660808276) by smtp.aliyun-inc.com; Thu, 18 Aug 2022 15:37:57 +0800 From: Baolin Wang To: sj@kernel.org, akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, muchun.song@linux.dev, mike.kravetz@oracle.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] mm/damon: replace pmd_huge() with pmd_trans_huge() for THP Date: Thu, 18 Aug 2022 15:37:44 +0800 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> In-Reply-To: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL 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 The pmd_huge() is usually used to indicate if a pmd level hugetlb, however a pmd mapped huge page can only be THP in damon_mkold_pmd_entry() or damon_young_pmd_entry(), so replacing pmd_huge() with pmd_trans_huge() in this case to make code more readable according to the discussion [1]. [1] https://lore.kernel.org/all/098c1480-416d-bca9-cedb-ca495df69b64@linux.alibaba.com/ Signed-off-by: Baolin Wang --- - New patch in v2. --- mm/damon/vaddr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 1d16c6c..cc04d46 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -302,14 +302,14 @@ static int damon_mkold_pmd_entry(pmd_t *pmd, unsigned long addr, pte_t *pte; spinlock_t *ptl; - if (pmd_huge(*pmd)) { + if (pmd_trans_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); if (!pmd_present(*pmd)) { spin_unlock(ptl); return 0; } - if (pmd_huge(*pmd)) { + if (pmd_trans_huge(*pmd)) { damon_pmdp_mkold(pmd, walk->mm, addr); spin_unlock(ptl); return 0; @@ -434,14 +434,14 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, struct damon_young_walk_private *priv = walk->private; #ifdef CONFIG_TRANSPARENT_HUGEPAGE - if (pmd_huge(*pmd)) { + if (pmd_trans_huge(*pmd)) { ptl = pmd_lock(walk->mm, pmd); if (!pmd_present(*pmd)) { spin_unlock(ptl); return 0; } - if (!pmd_huge(*pmd)) { + if (!pmd_trans_huge(*pmd)) { spin_unlock(ptl); goto regular_page; } -- 1.8.3.1