Message ID | 20221207002158.418789-3-vishal.moola@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3127732wrr; Tue, 6 Dec 2022 16:25:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eBWeGXgt9sBCHGhhtpOShGfrMYlRFMOhnRmGvAzQvj3ayvj5UMGU2Sy8La54rhWQX1SLZ X-Received: by 2002:a05:6402:b11:b0:46b:c86a:6411 with SMTP id bm17-20020a0564020b1100b0046bc86a6411mr24937457edb.417.1670372716424; Tue, 06 Dec 2022 16:25:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670372716; cv=none; d=google.com; s=arc-20160816; b=Dg7fCLvYMoGNsuFIDd/uQZmezAMzn570Ck8bQWSFrhpuhQebplXFZFBDyYJESlVuP6 awy3/gLTdoRJjHPovfUf/rbt1U/LQA2U+r1UyGNV/NL8f9+wvKARvCcYexZhyjKJEfBY WHD9U3rPgogwenwNVbqFc1XpCnnw8961ZVTYuCE1UkeC8a/YohSkS41oyHTklANTk8lM hACjdcf/AlQ0w57Q6Sr5tyMMlBuirtEVVwbDaSKu5wn29u6WOoIgl/u1dSpUTIiqjjcr tQVki2SOG2CidN6wf8P2nXseefXijxCt4WTbngGHJjn9vzCQ/rJrVWWjrVNGfrGYKgS7 3uDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7cFy10fUQvAp0c5CDE+pRKnURMHNPhPlaSgCKw+V2Qs=; b=YVoAGL83/iO76LiMYVUw1Po17+8cKFK+RIwjLWjL1fFf2Jp742dWjQRadUPQqZRlFD znaHkvybTVKkLmrizNb+2YtRsVZvyHT+7Kv3C4qj/h6qPl+4LD3bqwGHlaEyq4YLNwGf 4ycz0vyC6vD6A4uE8ZyJ7TFTtZgwf4iiLzGQ8JpuiRsnY3/48Xo7ZD6hzB2H32tCBLpM +Mna1cL+PmdmcXjRUlSOqoT36qKTnHd5L7QFRk6PLqz5+C06pu8HBiu3bp2VU9mo0arp YUzckyPIQ4ZQ5uKyYleCeHZJk2jOXpXjrwds/7tFwE+Y3gf6ex0pIAGowF1tmUUym0zG tiBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YHl28cpd; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs4-20020a1709073e8400b007bd71f57fddsi16109722ejc.803.2022.12.06.16.24.52; Tue, 06 Dec 2022 16:25:16 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YHl28cpd; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbiLGAWY (ORCPT <rfc822;b08248@gmail.com> + 99 others); Tue, 6 Dec 2022 19:22:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiLGAWO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 19:22:14 -0500 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A470A4B98F for <linux-kernel@vger.kernel.org>; Tue, 6 Dec 2022 16:22:12 -0800 (PST) Received: by mail-pj1-x1034.google.com with SMTP id o12so16030329pjo.4 for <linux-kernel@vger.kernel.org>; Tue, 06 Dec 2022 16:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7cFy10fUQvAp0c5CDE+pRKnURMHNPhPlaSgCKw+V2Qs=; b=YHl28cpdsLfmOjfipvqjWtXAOa0AMP8kDcueiJ2N/YI83AXK8AqWr/PutrLcLlXgWJ 6+oMgPZlwTZh56uWh1rOpt8mEc1ZKR5Y0LX4C1FdfryzT1T1yTtNZ1my5/TzolFCJPGj 8AMBoHbKNuHITSlPhfWgrrjoRrPaAkSr07h69DbLlVEoMAbBdKq5YyTT67xyp5jauvLQ imF0VJ4E31XeS909T0Ldb2JbgeDlNv45Jjr4N6f2BuVNBMf80lbVAcHnzhMKW4/Hcy3g 3I6djJdxa4FDRbQumuumNsGYUIgLJxYdme/OkCtciK0AFWkjDy3HYydVxd6qwRzG52Av 2EwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7cFy10fUQvAp0c5CDE+pRKnURMHNPhPlaSgCKw+V2Qs=; b=AUuZPhl+s2PdBAFnqDsjh+Het+Nrddl6L5o9uxzvEh6XP+uzhZXtCSC5KkXbRUsTL/ DDONgY2ZG5RrR+niP/dcSgjr8vLWIjMpuhqcNjJdOnge9r4UOTtOzA22W4LdwMnj+osQ cB4irTZoGflVtRSscinlezTwCyNReWcZlUVLCDvR2BDPIFmLMTFnmK9/ioophRKeWUw0 VHDAVNqCer/56lKO25njgJ69/VB2F8WjuKlUu3vUj4P0y0WXu8eHS6hQ685V/hHr4w+b 4a145w1mW4m8i5ZTNJ5d3Op3+teIRe+7ZvK5bLbtGXRiS7fUoG91rrtXnXm2j0KwoFKS 6a5w== X-Gm-Message-State: ANoB5pmMVjOmMvZdmurGBsKKIaL9+HbJAfqhN0sdp1VzQMmArHr3n7Lb uudKJ31Q9ABgMPQIxm1m4Q8= X-Received: by 2002:a17:90a:5787:b0:218:8398:5846 with SMTP id g7-20020a17090a578700b0021883985846mr93924762pji.241.1670372532129; Tue, 06 Dec 2022 16:22:12 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id i92-20020a17090a3de500b00218ec4ff0d4sm13369459pjc.6.2022.12.06.16.22.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 16:22:11 -0800 (PST) From: "Vishal Moola (Oracle)" <vishal.moola@gmail.com> To: linux-mm@kvack.org Cc: damon@lists.linux.dev, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, sj@kernel.org, "Vishal Moola (Oracle)" <vishal.moola@gmail.com> Subject: [PATCH 2/3] damon: Convert damon_pa_mark_accessed_or_deactivate() to use folios Date: Tue, 6 Dec 2022 16:21:57 -0800 Message-Id: <20221207002158.418789-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207002158.418789-1-vishal.moola@gmail.com> References: <20221207002158.418789-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751512741189649158?= X-GMAIL-MSGID: =?utf-8?q?1751512741189649158?= |
Series |
Convert deactivate_page() to deactivate_folio()
|
|
Commit Message
Vishal Moola
Dec. 7, 2022, 12:21 a.m. UTC
This change replaces 2 calls to compound_head() with one. This is in
preparation for the conversion of deactivate_page() to
deactivate_folio().
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
---
mm/damon/paddr.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
Comments
Hi Vishal, Thank you for this patch. Nit pick. Could we please replace 'damon:' on the subject with 'mm/damon:' to look more consistent with other DAMON patches? On Tue, 6 Dec 2022 16:21:57 -0800 "Vishal Moola (Oracle)" <vishal.moola@gmail.com> wrote: > This change replaces 2 calls to compound_head() with one. I guess you mean _compound_head() calls in page_folio() that called from mark_page_accessed() and folio_mark_accessed(). However, deactivate_page() calls page_folio() anyway, so this patch doesn't reduce the number of calls to one but keep the number, correct? Am I missing something? If I'm not, I'd like to clean up the wording. > This is in preparation for the conversion of deactivate_page() to > deactivate_folio(). I think folio_deactivate() might be a more consistent naming. What do you think? Also, you may keep the above sentence if you implement folio_deactivate() first, update deactivate_page() calls to use folio_deactivate(), and finally remove deactivate_page() definition. I don't really care about the name and the sequence, though. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> > --- > mm/damon/paddr.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c > index e1a4315c4be6..73548bc82297 100644 > --- a/mm/damon/paddr.c > +++ b/mm/damon/paddr.c > @@ -238,15 +238,18 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( > > for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { > struct page *page = damon_get_page(PHYS_PFN(addr)); > + struct folio *folio; > > if (!page) > continue; > + folio = page_folio(page); One _compound_head() call here, > + > if (mark_accessed) > - mark_page_accessed(page); > + folio_mark_accessed(folio); > else > - deactivate_page(page); > - put_page(page); > - applied++; > + deactivate_page(&folio->page); And second _compound_head() call here. > + folio_put(folio); > + applied += folio_nr_pages(folio); > } > return applied * PAGE_SIZE; > } > -- > 2.38.1 > Thanks, SJ
On Wed, 7 Dec 2022 00:56:24 +0000 SeongJae Park <sj@kernel.org> wrote: > Hi Vishal, > > > Thank you for this patch. > > Nit pick. Could we please replace 'damon:' on the subject with 'mm/damon:' to > look more consistent with other DAMON patches? > > On Tue, 6 Dec 2022 16:21:57 -0800 "Vishal Moola (Oracle)" <vishal.moola@gmail.com> wrote: > > > This change replaces 2 calls to compound_head() with one. > > I guess you mean _compound_head() calls in page_folio() that called from > mark_page_accessed() and folio_mark_accessed(). s/folio_mark_accessed()/deactivate_page()/ Sorry for the typo. Thanks, SJ [...]
On Tue, Dec 6, 2022 at 4:56 PM SeongJae Park <sj@kernel.org> wrote: > > Hi Vishal, > > > Thank you for this patch. > > Nit pick. Could we please replace 'damon:' on the subject with 'mm/damon:' to > look more consistent with other DAMON patches? Thanks for looking over this patch! I'll make the subject mm/damon in a v2. > On Tue, 6 Dec 2022 16:21:57 -0800 "Vishal Moola (Oracle)" <vishal.moola@gmail.com> wrote: > > > This change replaces 2 calls to compound_head() with one. > > I guess you mean _compound_head() calls in page_folio() that called from > mark_page_accessed() and folio_mark_accessed(). However, deactivate_page() > calls page_folio() anyway, so this patch doesn't reduce the number of calls to > one but keep the number, correct? Am I missing something? If I'm not, I'd > like to clean up the wording. The 2 calls I was referring to were from mark_page_accessed() and put_page(). As you've noticed, deactivate_page() still calls page_folio() here :). > > This is in preparation for the conversion of deactivate_page() to > > deactivate_folio(). > > I think folio_deactivate() might be a more consistent naming. What do you > think? I do like the name folio_deactivate() better than deactivate_folio(), I'll change that in v2 as well.
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index e1a4315c4be6..73548bc82297 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -238,15 +238,18 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( for (addr = r->ar.start; addr < r->ar.end; addr += PAGE_SIZE) { struct page *page = damon_get_page(PHYS_PFN(addr)); + struct folio *folio; if (!page) continue; + folio = page_folio(page); + if (mark_accessed) - mark_page_accessed(page); + folio_mark_accessed(folio); else - deactivate_page(page); - put_page(page); - applied++; + deactivate_page(&folio->page); + folio_put(folio); + applied += folio_nr_pages(folio); } return applied * PAGE_SIZE; }