From patchwork Wed Dec 21 18:08:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13079044 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 A82EAC4332F for ; Wed, 21 Dec 2022 18:10:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBC798E0007; Wed, 21 Dec 2022 13:10:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ACF848E0001; Wed, 21 Dec 2022 13:10:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 799A48E0007; Wed, 21 Dec 2022 13:10:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 60F508E0001 for ; Wed, 21 Dec 2022 13:10:05 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3BC0E1A034F for ; Wed, 21 Dec 2022 18:10:05 +0000 (UTC) X-FDA: 80267102370.06.1566D3E Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf15.hostedemail.com (Postfix) with ESMTP id 97F86A000C for ; Wed, 21 Dec 2022 18:10:03 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SVH+DMt9; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1671646203; 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=IxCbMv7vN+MZYskgQiQXZaUsiwZjC8DQb1oWsEzg+wg=; b=72OjCyiB1108fY3qd1Wu5596sMZdvGiMcJJJbXnv7saiwg8Z89tVJTks8x23FEM78mkJIk 6DSY2kSi8uyCHmqd5oD8JlJRQtTZDpeTBL19jIl/H+zlqSUWCuDVEFntNOhdI9igx6TyZj FRbnBz3NoTjESCAmVDOdOybG0o8oeZU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=SVH+DMt9; spf=pass (imf15.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.47 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=1671646203; a=rsa-sha256; cv=none; b=Hhohl/Zj+OtS2mFVLXbaAaUPTR6TSA11tL4IyA+lbSIHLSXbTFXt07xruiKodLCLXpPPWC CpZfCrPWUH0W1TOWLM5Tt7iFfl78G0H6C/oXECm0BZ1355nz5zzmFoSdm4zPwQiJA2nyVm 4Oq7WxFv5QsFwQrB7OrHQeAVnxOLdWo= Received: by mail-pj1-f47.google.com with SMTP id u15-20020a17090a3fcf00b002191825cf02so2850496pjm.2 for ; Wed, 21 Dec 2022 10:10:03 -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=IxCbMv7vN+MZYskgQiQXZaUsiwZjC8DQb1oWsEzg+wg=; b=SVH+DMt9Og+wCpl3/C5BsDiXi0R8onKGMrhpkd4hAlX8bvnTiVKmDxskppX9IQkPrD 8Sd4evv36aHQ13uRz8HuvrhsBcWuFhUALcpXcURwBX6tiFSJpCU0wdSdBmhHkx7XIrr/ JyVRdZoqnokcrqk6Trie7l/7hWBpcvarMU2OLhZ6kJiKEYRNdIksrOfLjFawMwNn6O2p jCmneIA6JP/TtPv5fncfMTNDHOeJ+bi0Qpz3foORBcwYPuBPLReKoQaHUJw3l+w3OALk SUx0tixRN0rcqO5jTqxXfiyWmYW2jH8GSWHBLkGTNVr9roslowxH0YAB3zgJLd+OW8R5 o8Ig== 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=IxCbMv7vN+MZYskgQiQXZaUsiwZjC8DQb1oWsEzg+wg=; b=wpQ8ZqvO+P5KrjgMVztvMHzmRFwY6bpb/TgvkNdWlsidDA6ZrvFt9XN2FljhPNOg4w llg34dPVoP3eNk1GuRbIHrz4UZ/ve+QWU9gwiBLU0jnHWducY1A/PxuJEXJy5f/iydsJ 5qT4sKINdmq4Z3Z4pBouUTYLF3URX7yHFEGvt40v7enoIZBJF6xoLTNqAaSrXjDlQytg e1jUD3kPVqVsuoz+rujlosIHhHYeJdwr5Z/IvqO9Zs4Pw1jAIEzF4OV549yemvabpodw 1L7m/vxKFTduwVXA39EGHu4mNJMbMtlrG0p/DqLOY1TV0917GTioxbUoDxrJQpfPd84c E7dw== X-Gm-Message-State: AFqh2kpR6GdZxTsWryXj4W7yFmPj3w07/E29FuiLJRQ3BoI+00ZPg9AD 81SlyWBQmgJ4y3ls69AJbgd+sylOBREnHQ== X-Google-Smtp-Source: AMrXdXu7sLHZOSQkUqGfVCYqV1RGYszssajWNznlILD5f7tvBuIfHAUntNoH41lSWlaha/5S+8g8uQ== X-Received: by 2002:a05:6a20:2a09:b0:ac:44ab:33fa with SMTP id e9-20020a056a202a0900b000ac44ab33famr3315612pzh.37.1671646202232; Wed, 21 Dec 2022 10:10:02 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::a55d]) by smtp.googlemail.com with ESMTPSA id e26-20020a63745a000000b00477bfac06b7sm10110732pgn.34.2022.12.21.10.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 10:10:01 -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, willy@infradead.org, "Vishal Moola (Oracle)" Subject: [PATCH v4 4/4] mm/swap: Convert deactivate_page() to folio_deactivate() Date: Wed, 21 Dec 2022 10:08:48 -0800 Message-Id: <20221221180848.20774-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221221180848.20774-1-vishal.moola@gmail.com> References: <20221221180848.20774-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 97F86A000C X-Rspam-User: X-Stat-Signature: uncj9dq193wia7ht1kfoafqc3shffotj X-HE-Tag: 1671646203-513413 X-HE-Meta: U2FsdGVkX1+KDJMDGc/1sjMXkfmXGwcFYLwOcq8ADrVVTbpbV/KsE6uxfelUt1P2pwCcC91u2GDVjnKZe+m/EilbEh+yNSwbbP2pz8fDGXtegtYF5R7Vx6Nqh6cWMIZzKKqpAH6j7OIqTXmmQM6/ED4Fr2opcVxtsD03TV9EISBAF3CaVybv92XSRLNb53+m0NGchjEw2ERkoMlD3W4EEuMzqVvPOAbhnJe/sBEfYObi9MAKvu1G8tzsD4QXmzRyCXFI6BDsbXE2fqtSQZTO0IUEFxXSCQA6piZawpxyOpiB1rZFSGt7Uo98khbhPPKRxkjbLxptokHPNhyohTIP7e3VOgala53l00RqeO7OaqWDoPd+P2DbnJnSoTTDhtOjGUtlsuOFchi+qOu8G9vwAhrlDJydct3waHe1jNnxFDSCZWsDqY19A2kVyMISmDsi3AUZTG8NroJGaYNZ1PWzYhPrBWqiWKkxwei4i3t0s9V8+NiDWl5VZ9rRp8SpDXiEARe4zUuNhHAm7HNEb4GHve7pjecDdp1LEmtO2ZaFD8zPEiY6CsACoNKRT8Ztkkaj1yvs811nAJDqbA3jqO/2e5UpSfGH4DrngbSWU2z1k9aRRH4L3KQnq4mYEux6YXtfvTUTG0fMW/pafMc0f5TysVJ/vbxAtx2Zs7hA86/MUOv4f0b1OcsVkpGbAJKj3XLA8gcw8olBbCCENARtIfJcpbfVWQ4JuHZLWIfiWoqAKzQkYWMkvHbERehUGxHdYMdE2vjzvRhoIGC5yQe/k9FajdiYRxyIj6qG7ATesxhzNlhwHz23LxoKWDN7I/c2VxMbULCpowVwbNyHQvCoFpGStgOhXNfOyKl6J2iOwzp2uV+YPfW0qsx0AFOCwGP+MisvSGjDuM4iREbjX3RSlsjgBDKmC3vDA6AeDLgGXlI4+Y+wB9D71jCOIJT0rLkfevwGqcfeuZBuFng/7/WS2VF PICAryfp K8LpE7gxzRfCGeuwJpE8wcxAd9GWOZEOfZ/rrllMMB1gqW/asubg22fDZSLj8a5GEezHT9k/ofw91noT9H6HPSr4eCcpjaJV5XwLLf3e5+kitC+uHItzBrZW7rF0mMf1/lrpV0EsN8jPBBAf6D/4FMMBqMYNLvGAh8MonaNXcw3i08/oEwZFAPqYXfVl41uNJrlT7BjmEplDV0NHLV38Gfn8dDgZbD1+9MJXCp/Iw8IJsX/CMosP9kZaXR/6KwMufayVWsS/r1eb1BgHehL/M4FDG4Q== 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 f965786710b0..209a425739a9 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -401,7 +401,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); void folio_mark_lazyfree(struct folio *folio); extern void swap_setup(void); diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 884c8bf18b12..6334c99e5152 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -297,7 +297,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 851d977b9b03..025be3517af1 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -416,7 +416,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) @@ -510,7 +510,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 5e5eba186930..e54e2a252e27 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -733,17 +733,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;