Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp139957iob; Tue, 17 May 2022 21:35:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9gNLY69jJFFa7Vo9nsLlyFW+tChbTGbyHF5mjPKqg3dAmQIn7RUGSHjuevMdPsifC+h7h X-Received: by 2002:a63:4145:0:b0:3db:2e7b:4f60 with SMTP id o66-20020a634145000000b003db2e7b4f60mr22247311pga.120.1652848534833; Tue, 17 May 2022 21:35:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652848534; cv=none; d=google.com; s=arc-20160816; b=00mSbwZQJnLEjQuDGoM+OSxBrTKvyEjZQa649HNJZ6CvPr57RWUHq0w27d3IN9kXXf zvU7yh0oAyVG9RYW3rnIB0VaFk9ttABRlt4RPzhGvEcXgmlxDjBVAxSOfxRQk8Kw7iIC Rbi+C7fk0Q3Is8mrYjzeexXU5awXHOmcRzH3nus/MVkATnOoij5Vo/Ou2H5SS6kJQtug yRgHIUnx0ok8mIlbSMAiuZ2kINs0BBq5q0NEXL9lGKXjhsO5Fp13zKyUpsEUR0VEff8J h9UR57ih2d9OeuxVkuSOSgQU5Ly9gX5LUFBJw8Kheb+SmX7T5AWLxcVPp0erQDDH3vro MPcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FafTOSC1jDOSLYkrsU5gXL7FBnEW+V5hA1VcTwa7oUg=; b=e2TQTHyFkHqNs+L7DAlhyKBt5CxbYUJl2n5Z2kGfuZ38cqtH4ILasHzytAf7jhc6Ql lzb56qaeZuKmKfvLOJqSNphCSAJRWDezY95BA3jgHZUbmtdPRsI5gT9i8W8tz88t4Ejw 9CIWlSZ4Qai8v7do8ki/yhvmWdF6S048rQiaTvllhIWSnaF8kDHUz1qQVZTOQKNtFzcw AN4Kgm3bEAI8qck/p7HyhsUzTK5vLZEAqWqO7rzqdw8Cnd603Jrcb511gJVYkxUQ4/yf c71+2NrzmnyPvIlMP7iJFZXJ7oKMMAsr889RiAfUn1XpRVjgICeBhzdrPQXesO4cv2+A gK1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jyCOSe3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q1-20020a170902eb8100b00156bdbdedf4si1156207plg.269.2022.05.17.21.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:35:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jyCOSe3s; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B4343939F0; Tue, 17 May 2022 20:53:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244403AbiEQPqh (ORCPT + 99 others); Tue, 17 May 2022 11:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350829AbiEQPqJ (ORCPT ); Tue, 17 May 2022 11:46:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7C4453B42 for ; Tue, 17 May 2022 08:44:21 -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 sin.source.kernel.org (Postfix) with ESMTPS id 0AE06CE1B02 for ; Tue, 17 May 2022 15:44:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64429C385B8; Tue, 17 May 2022 15:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652802258; bh=3JSsXFST9KyoIwls6TvVF+LwrCQkhOldDosferXWQ40=; h=From:To:Cc:Subject:Date:In-Reply-To:From; b=jyCOSe3sU2KM84gZWi0Cr0liF05JQ9Vs2NENC6Cy8KJUyEM6GbI+TbhJnS+4mSeu2 rZn05+rg0iOX2y+CNgnmqUpLmByMKy9SoL++HGXhzppm24/3THyBuIv6/N8B4R+gFU SOYtSRCLZgEoAxEFe0PX63ZN7bSMKzrfGHW+7xwbqUfnLOhzDU9+DFSpnlmBSDv+pn KMmTYEvlRzrAPNljiJf1sdG772Fu6aJ1hmPvllxErNfuGrlXMYf7ruoLC+5MHYGS2P qCKv7LwRhj2MgTMKOh3t29vq1mDBiCO+ATHxCG71Dzyw5evXlcJQ/bvaUFULOCwmqg 4CQxHry6eaQXA== From: SeongJae Park To: Kefeng Wang Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: damon: Use HPAGE_PMD_SIZE Date: Tue, 17 May 2022 08:44:16 -0700 Message-Id: <20220517154416.32646-1-sj@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517145120.118523-1-wangkefeng.wang@huawei.com> X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Kefeng, On Tue, 17 May 2022 22:51:20 +0800 Kefeng Wang wrote: > Using HPAGE_PMD_SIZE instead of open code. > > Signed-off-by: Kefeng Wang Reviewed-by: SeongJae Park Thanks, SJ > --- > mm/damon/ops-common.c | 3 +-- > mm/damon/paddr.c | 2 +- > mm/damon/vaddr.c | 2 +- > 3 files changed, 3 insertions(+), 4 deletions(-) > > diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c > index e346cc10d143..10ef20b2003f 100644 > --- a/mm/damon/ops-common.c > +++ b/mm/damon/ops-common.c > @@ -73,8 +73,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) > } > > #ifdef CONFIG_MMU_NOTIFIER > - if (mmu_notifier_clear_young(mm, addr, > - addr + ((1UL) << HPAGE_PMD_SHIFT))) > + if (mmu_notifier_clear_young(mm, addr, addr + HPAGE_PMD_SIZE)) > referenced = true; > #endif /* CONFIG_MMU_NOTIFIER */ > > diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c > index 21474ae63bc7..b40ff5811bb2 100644 > --- a/mm/damon/paddr.c > +++ b/mm/damon/paddr.c > @@ -106,7 +106,7 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, > result->accessed = pmd_young(*pvmw.pmd) || > !folio_test_idle(folio) || > mmu_notifier_test_young(vma->vm_mm, addr); > - result->page_sz = ((1UL) << HPAGE_PMD_SHIFT); > + result->page_sz = HPAGE_PMD_SIZE; > #else > WARN_ON_ONCE(1); > #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c > index 9a56ff60f244..5767be72c181 100644 > --- a/mm/damon/vaddr.c > +++ b/mm/damon/vaddr.c > @@ -443,7 +443,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, > if (pmd_young(*pmd) || !page_is_idle(page) || > mmu_notifier_test_young(walk->mm, > addr)) { > - *priv->page_sz = ((1UL) << HPAGE_PMD_SHIFT); > + *priv->page_sz = HPAGE_PMD_SIZE; > priv->young = true; > } > put_page(page); > -- > 2.35.3