From patchwork Wed Dec 7 23:01:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13067737 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 4408BC63703 for ; Wed, 7 Dec 2022 23:02:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A35C08E0006; Wed, 7 Dec 2022 18:02:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E6508E0001; Wed, 7 Dec 2022 18:02:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 776B68E0006; Wed, 7 Dec 2022 18:02:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 687FA8E0001 for ; Wed, 7 Dec 2022 18:02:02 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2EE1A40766 for ; Wed, 7 Dec 2022 23:02:02 +0000 (UTC) X-FDA: 80217034884.13.8D6F71C Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf02.hostedemail.com (Postfix) with ESMTP id AAEA280017 for ; Wed, 7 Dec 2022 23:01:59 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aRW3STV7; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670454120; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ihy8jPmuCwZF2NUxckyF8mvKKJAfgGLMAeVZly3BYIQ=; b=quhlxdTSQ9XXeKTJ6/RIw4fkl6xBlbIRt0zgM6gyeC6UIKEELEl/YGx7fnntMIqghUjdJx RD8mg7w9eKsZStsO5LF/qPHvetuGNtmOW8qZyyUuxPwGDj+nUdWmrpip6BPdUa4jjOOaAQ +eTZW6WQrOZdgM4MCNI8l6MGn9GcGBI= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=aRW3STV7; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670454120; a=rsa-sha256; cv=none; b=K6FyaP/lxqCyIqcMREQnJiguzYTeQ3DGqpkcYANnFTKBs9SPamjedLVMkNdMWQJn1Umhk4 jfcoyf/cKEzxdZSW6DdgYLLHu+WTYw5zlY3p/JCaGiunOkyZf4zioWVK9PApWBwn7i5O3C DI1i/fJ0tgGZSk5+qSuIN5oFNZ8XsvU= Received: by mail-pl1-f177.google.com with SMTP id g10so18451200plo.11 for ; Wed, 07 Dec 2022 15:02:00 -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=Ihy8jPmuCwZF2NUxckyF8mvKKJAfgGLMAeVZly3BYIQ=; b=aRW3STV7RblLr2UZyt0OTfxbCMJqzXcDNCvfPBFSL8j4JPwCmtZkBnAWT2aBKleJxM S3/S1x1bm1MpdH3mCRtHaNVJoA9agm3kV/DY2R4ALu1LaFoVxFx25litGpXvg0Pvv3gh uoVb7nRNI9Qsr8wEjAMXHbfKT2kJbq0+RJAy9yhPqI+XBxbk4puqiVriF0clbfnRW70s BoqZQTnhKW+xtH8CD1pB7fQKPmCtUiJwD+YIRriTaJAr7X6qPNEhR1gMWRbwuwhYFKuc 8gjib0AzihFb9ybVk0MTROBvleagUuf+5ZDDM3BziLgRNQJLYQgKz7T7B91ISD3U5F+A JrAQ== 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=Ihy8jPmuCwZF2NUxckyF8mvKKJAfgGLMAeVZly3BYIQ=; b=lGxEJ9PmMV/HTAOZY/9WLLIzkVw541x9j7XMNTQcMT8GMXwKs9E/JXPbTyA1XnchRP N9oF7FNaCKz1YJafQaKYmOD8Pt1F6Bkn2Yb2BKdW8K2xgaiRuHAmJ+ADr6blNoj7lqjT ZS2186IfjNAjIcVbCEaA6qLsvf7KD/7iEcCdQ0RIS84IvYKN1m8BKLrPt5Wj4/kBYXm5 23AnXGzelR44KdFlh0wMSOB0bWHF9nsUu3fCXalo41PJlfqQDakdCt7yoSVC1Uw7bU4B QicAmksRZVyFWgUBpz2FSr3rUtVqXImSR3Hs1WDw8FZOUZoawTMxppW8XKfR2yIZlKVq 9/cA== X-Gm-Message-State: ANoB5pnbr2scNRNbh+WQxYri6WNoUyzwt0CgnlCjd6GikO1wqAO5SeAd SO7Ypuf+LmZ8iLDJkVaUMUxp/nWjy8UUaQ== X-Google-Smtp-Source: AA0mqf5OWOMX/v4jZwZzxW/+LnUXUxbUa7hAE7DKvC2Aq3cLs4HP8zm+Fl2Ofy4HrmxmV6JJeb1A1A== X-Received: by 2002:a05:6a20:a028:b0:9d:efbe:52b2 with SMTP id p40-20020a056a20a02800b0009defbe52b2mr2023625pzj.34.1670454119220; Wed, 07 Dec 2022 15:01:59 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id pc16-20020a17090b3b9000b00212cf2fe8c3sm5411033pjb.1.2022.12.07.15.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Dec 2022 15:01:58 -0800 (PST) From: "Vishal Moola (Oracle)" 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)" Subject: [PATCH v2 2/3] mm/damon: Convert damon_pa_mark_accessed_or_deactivate() to use folios Date: Wed, 7 Dec 2022 15:01:51 -0800 Message-Id: <20221207230152.22938-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221207230152.22938-1-vishal.moola@gmail.com> References: <20221207230152.22938-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: AAEA280017 X-Stat-Signature: jwsbtqad5gigyggaakwqm7xms97ku8fb X-HE-Tag: 1670454119-732536 X-HE-Meta: U2FsdGVkX18g9Y9ZniiFr09nn9a7oX9RBVK5VyIoDG2lf/K82dTSX2YQNpfCKJ/tJwuY/IVb5FcDljYdbDKW/ZAhmofoDakHncIzi1ADYPmQMJDWdzoYWso5napuc1DHNYQpGuor+KyC9m3GZb5WrHUtXRqUaLaJ/8Tie2SYxcqecWfMb+0B8m1JdkhEjyUw8gUSmsZaZG6eZQI94BJGApdmI7EsR8+N8pkgDrJJt5PFxWdCFwOEOA6H9OD3RXDpoYUdXciHUmABl2P0iavghiRZBidHIQ7KO+neqls4nMafdH4UrnKttBcaSvoLofCNN4CIT3fg/ykBBH72hHX0M2ooFwzdpRNzKcJOhVh+//5Uoc3KAEEr7Xrgihx0pRndCAFmoz9k0bvZ3EnWO9+8gfLesuKmV5i09sDmBu2q3V3o+OMczU+FsxM5eNbVnr94Ws9CFkZiqrqCpYkXgc/JKS2j5+zQOiNJGJru6NvwXdRoTm18sScGogQdfpwvwPuxnbAbJxkIhPjz5KjxD7+v89VsNMTMI2ZqxczahgTRjpn5etcVfsPbZgBAwnj8pQ0k8luZrc9BYEqWvlCbj62TnmfcQ0r8Prnd2VTgNVT1YXx9JIR5pm3GEfbjxKCqXpWJqoTzB4iaWDy+dCuq4Xb3it4GOnXgxjYwmIPB7QRmwUp6vTjP1EsmXPAOYnCOCjFiqTiPqFVLJeaYOD8tWHiSFDmty5i8LlrvRp52ovkD4enqKkseDXdI2xL+/jH5qgE42MOTXSUnetUrF2Lm1oCxhveb03bQ3kftY6Y0SfcRvIieCqgdQCHUK6GW6XZM/E3JIzCnaXKzKDivDGwclmMF3ymDXBHUn6AXGJjL0FoWVb5jUI4OipywRi17cg2Q8XkMoM2uWn9q7pfB/6puEpvrcWMbfJHMo9VW3eBHxCeBMbISYzUIhSwwzezIPsfPfaaiqdNgzwRDk7thX3R1J6u zTWW+3/l /PUR0BJAjhTAT5mi3MnWB6/949B+Odx/ae6Y58rt/tca5Cv+UfzWLiwhzpGh3BjetCdebh3uD7mKdsTOI5LFXpV49+zUlqqidXAfqZ7zFl6DmOeuIk0OaimnJ5Wc6yDUpysn+TbRjXbvOFcPfgQ//JzEEb4nuUK18w5jtiIJ320uM0yT9ESJZCmA4PWfaH3D369ktcEIJIsfK/ieTIebFAhkq4geo5Jg3SBNXEFO9NCTHsYuyJ75x6N8s8UsHwvv935gbzl6yczuJwPQrVn97yvILzQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000924, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This change replaces 2 calls to compound_head() with one. This is in preparation for the conversion of deactivate_page() to folio_deactivate(). Signed-off-by: Vishal Moola (Oracle) --- 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); + 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; }