From patchwork Thu Dec 8 20:35:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13068868 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 914A1C4167B for ; Thu, 8 Dec 2022 20:35:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 890988E0009; Thu, 8 Dec 2022 15:35:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 840738E0001; Thu, 8 Dec 2022 15:35:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 61E228E0009; Thu, 8 Dec 2022 15:35:14 -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 4D8A68E0001 for ; Thu, 8 Dec 2022 15:35:14 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1E499AB6C3 for ; Thu, 8 Dec 2022 20:35:14 +0000 (UTC) X-FDA: 80220293748.22.0C4EA30 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf10.hostedemail.com (Postfix) with ESMTP id 64C55C0014 for ; Thu, 8 Dec 2022 20:35:12 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iWudK4xr; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1670531712; a=rsa-sha256; cv=none; b=F1APTdjWxnR1wJ+OXWfBejwsWKg5Cu/A4X9L9ktWNU8aNPtBOLR6Wrgb59E5lZSdBxL/xC qaaoRuUz8GBm2Cm0dAJhb0hsMrUrf2t62iNGBeLAXeG40FdVAYsOLvzUsNjRaaY2nhwMHu dOuFC998E08C+4jWwvITHb8qT8M96Uw= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iWudK4xr; spf=pass (imf10.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.53 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=1670531712; 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=IgIdh8nt+mq77dQQNk9/S7rfV6TiIO4QqyG3Sqp+yaY=; b=YoT7oMPYGHTDQ4YmosYm8GCmlzp1aCXlwwMZTHxuZkNuLUA4Vr43QKzmmjRitj9VpSvn7l xmLbV1p7T5cCgoM+SjjYA8pV8wGwsAs3AKglH0QktJUZiiP1fsDyIA3yiUxM8EzcAxNO2Q Hh1sp0h+GCcIPiEXRWvs/Cq/bvVOcIU= Received: by mail-pj1-f53.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so5878528pjp.1 for ; Thu, 08 Dec 2022 12:35: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=IgIdh8nt+mq77dQQNk9/S7rfV6TiIO4QqyG3Sqp+yaY=; b=iWudK4xr8eyn/01wdfoGvrxyUZ3k1Zp/c9SZe2LcNl4BOQDgNz1rrGJo+5CwWhbxsB ekFj/Vx5q+l+Er2zXRcjiwwJ7Org396Wm7q4Qi1iKNkG/8p8agHenkkce3pEZ2WWcyJv HWDgSY5KjyzddNWRNvF5+ItpMrECfjvrPJdosOTLsMFYLgac6nNGyRFOwiYuGbaC2MoE dbZNnKV4+iKB3vUXa9waapqdDgJkv+WDMARouAaHEBewwulZ+Bj8Q56TL7piK4KIKDcW C3m6/Gz0ZDe4U3xG2q8ctJWNYAp/WE2rQqaalZBdrEiETAX6nj01t2ihO7VPs3yUYnGw tn4Q== 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=IgIdh8nt+mq77dQQNk9/S7rfV6TiIO4QqyG3Sqp+yaY=; b=1nMEcu5UzicGNV58aFDrT83JXe4kNSba4Cs+QrxqRPdwC30sFQti5QQJMXJMgZW0JH YyiUjSC6blLWUlFAuOxnRhT8v+0qstl/YO/D4P5GV4AKumBsrbDVTqwrrCdzDEf8u+I4 JHXCWUal1+g0cC2Lc3Tgg9Mks9qqDsLLA4Ibl8JJ0pRj/fuJBt5XtrmfLST8KGPSnofH tryErC+dhaSEcu7CdsbR5R/t4wL0tnJ/80pJfBVfTeZ9YDjKVK791dFYlRnnCxHNXBz2 yoURYARwF1yCX5Abpb1RoE0JzxJfRWjJrMP5oI/KzsNdLx+3kqmvkjt7nhW8dIKszeZO H+2g== X-Gm-Message-State: ANoB5pkVtDQFZP/q+v/HJoeTHj42d8JDJ3lQ8kKI7o5mXpeH0R5Y7uFM UwycsD01UWAP/ye8m0SsKEbo6lCho4A= X-Google-Smtp-Source: AA0mqf5LuEF6hw5v4QfYtY1YTYCQswEq2LvxbAKaP13F6C+lHoQVP968dI3AQN2b+rJ2dSyg/9P1qA== X-Received: by 2002:a17:902:b289:b0:189:70c1:4ff5 with SMTP id u9-20020a170902b28900b0018970c14ff5mr3560139plr.37.1670531711111; Thu, 08 Dec 2022 12:35:11 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::2c6b]) by smtp.googlemail.com with ESMTPSA id f5-20020a170902860500b00189951514c4sm16954349plo.206.2022.12.08.12.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Dec 2022 12:35:10 -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 v3 4/4] mm/swap: Convert deactivate_page() to folio_deactivate() Date: Thu, 8 Dec 2022 12:35:03 -0800 Message-Id: <20221208203503.20665-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221208203503.20665-1-vishal.moola@gmail.com> References: <20221208203503.20665-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 64C55C0014 X-Stat-Signature: j1es8g18dccncoppngtkp3s36i6y493t X-HE-Tag: 1670531712-376688 X-HE-Meta: U2FsdGVkX1/BMLBFM5Ybkwf1f5cU5ljCh8Zh5MHVImDltm21wXOIREdQUilAqlbEOJnYpuuVm6gKsJhXG92ImoaiudgiHdQjkBvb3cQrk4ByRIBYj8c499U/IHOU5fKXtXAg81qK/g7iq8lhUeygmVFb9jIVa6/AZINeKPIdax1Dry6fLxJNmCnvZ1bQ1yQaNK5JhNovp0lektirUNkgQqzrLtKgFkHogJVDX1SGRpahpQno/5LOn3ZCKGE+1f4zfTNfoZzmNFx2Oo/QKwbNZeFOUmzUzNksL5yUIKlvW6tpPDBNXYeA3KniLe/aPdPk/UHx2/jKcrOGmDdPBegGlBK+COmH4RDHcRan8khhP7cLelTcrgWowmzDZdMPkp+3RbM7DK0VqRBLI+DUKaiz+eOPCPHGmWyuRvRaQwlHUWC+ttV2nKU9tEC++rIW+qUWoFKJoEulPYsWnGzrzfAAghPx8iXWjMxsBoWEu8vinllwesnDmZ/vPwpFoKi0D2n12O6Gqfv4cGl+FuhAQYL9hNZJY9vK8LqP4/FapCA+S5+sBj4GqV68NXZThOUD7tdrQp5N26bp7E5d0X+nGSO1PGMpGd1USv5tCFlhS6+39VBquZo5vxBr7LNiROtW0Ck3GXcnylHrAm4Zcw/N+Ze7hdO3dh0iDULSPOX5kers5oFum0AKU5AWfP2dPMHIm+tsClM9C/bgY6t27F5uCdsZ4r435CpqmUSGGqpDRDS+YzUZW4eyYj4NQV8hkswpnJ90Oz4259A0wxkbKV1hdKi+KqY1uRdwbl9+Fhnq2xR9qjZcB/fryfagZBh3w0quRrVVmYE7nIjxLxPz73/2p5QP4IDF66Au9u470erqEvNovxanfPHc8zk7543TgTJt+dtDKahiTAiuEvc+v/nL2dmIPRsQmF5mZ7jvcIjcWNKTC27cbwM3K3U5bLxpKIfp4Br+eon3pEuB/N0QJjkhI1Q vBCMBVNX hj/MhzLwQM3liTD9IT3KzOoakHWHQIQ3fx0p+GhXeuf+5BMUtCVgcKWCYQnMUrKClmK4ba2/Q3Qlj75IrsZkhOsBvcjJeeA4tDm/6wHkIMudrMxyr4KefJw2EGFlU6aQxHatp9q9IhXTMcJXwWRm26P9XfYE99+AGkzZEIDAN7Dbh0KuD2RTZxxsW9pnY6FUvtaqVLKh3snEEBx0hZoU+9StqfQ4e3l5YBWeDHw6TdZjeDPHg4Plie65AhxeA6ixzuJgUTL4xjDZ/3AuYpULrlpAsBQ== 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: Deactivate_page() has already been converted to use folios, this change converts it to take in a folio argument instead of calling page_folio(). It also renames the function folio_deactivate() to be more consistent with other folio functions. Signed-off-by: Vishal Moola (Oracle) Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: SeongJae Park --- include/linux/swap.h | 2 +- mm/damon/paddr.c | 2 +- mm/madvise.c | 4 ++-- mm/swap.c | 14 ++++++-------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index a18cf4b7c724..6427b3af30c3 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -409,7 +409,7 @@ extern void lru_add_drain(void); extern void lru_add_drain_cpu(int cpu); extern void lru_add_drain_cpu_zone(struct zone *zone); extern void lru_add_drain_all(void); -extern void deactivate_page(struct page *page); +void folio_deactivate(struct folio *folio); extern void mark_page_lazyfree(struct page *page); extern void swap_setup(void); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 73548bc82297..6b36de1396a4 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -247,7 +247,7 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate( if (mark_accessed) folio_mark_accessed(folio); else - deactivate_page(&folio->page); + folio_deactivate(folio); folio_put(folio); applied += folio_nr_pages(folio); } diff --git a/mm/madvise.c b/mm/madvise.c index 2a84b5dfbb4c..1ab293019862 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -396,7 +396,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, list_add(&folio->lru, &folio_list); } } else - deactivate_page(&folio->page); + folio_deactivate(folio); huge_unlock: spin_unlock(ptl); if (pageout) @@ -485,7 +485,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, list_add(&folio->lru, &folio_list); } } else - deactivate_page(&folio->page); + folio_deactivate(folio); } arch_leave_lazy_mmu_mode(); diff --git a/mm/swap.c b/mm/swap.c index 955930f41d20..9cc8215acdbb 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -720,17 +720,15 @@ void deactivate_file_folio(struct folio *folio) } /* - * deactivate_page - deactivate a page - * @page: page to deactivate + * folio_deactivate - deactivate a folio + * @folio: folio to deactivate * - * deactivate_page() moves @page to the inactive list if @page was on the active - * list and was not an unevictable page. This is done to accelerate the reclaim - * of @page. + * folio_deactivate() moves @folio to the inactive list if @folio was on the + * active list and was not unevictable. This is done to accelerate the + * reclaim of @folio. */ -void deactivate_page(struct page *page) +void folio_deactivate(struct folio *folio) { - struct folio *folio = page_folio(page); - if (folio_test_lru(folio) && !folio_test_unevictable(folio) && (folio_test_active(folio) || lru_gen_enabled())) { struct folio_batch *fbatch;