From patchwork Fri Dec 9 02:06:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13069129 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 6956FC001B2 for ; Fri, 9 Dec 2022 01:49:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 927A28E0003; Thu, 8 Dec 2022 20:49:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D7E38E0001; Thu, 8 Dec 2022 20:49:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A0E08E0003; Thu, 8 Dec 2022 20:49:38 -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 6A0038E0001 for ; Thu, 8 Dec 2022 20:49:38 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 40520A0F70 for ; Fri, 9 Dec 2022 01:49:38 +0000 (UTC) X-FDA: 80221086036.09.94421C0 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf16.hostedemail.com (Postfix) with ESMTP id A5B22180002 for ; Fri, 9 Dec 2022 01:49:34 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670550576; a=rsa-sha256; cv=none; b=U9obhzfDOLa5MYNkhZWu3V9JDjSWozPxnBZ5aEe/kQ+bGz4xDbem3iKqTwg4AnbHWf3bCA KjQ/1hX39uvm2Ju0g1nkwu3YrCmmdsOBe/qAZKXUYuChj3X42FjKSLtBj/LbcXFiG/zpbQ R8ztlfOd/MHAhhI6O/X6dghtf5sEHzY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670550576; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=waxCLHrd9gPTFpAoT6VqHQibv/wMQ2sBav6ZV6oPWO0=; b=Vnzi48Q2dZXYxUoyi0AFp5F5r2MUYQSn9+3UBzg1bOzEFFSUDMq+yFn0NCsiCgObYweYFd BIaYYIrhDLMsF8KZNuSFhAQ2iYHw6F57tC30gVVpmUKNu8+gAIxFR2aHGcXmZ5CKXJSWuy Y1MDbz5n74POKfFc5LziQwUU3895P3U= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NSv3f6f9KzqSt4; Fri, 9 Dec 2022 09:45:18 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 9 Dec 2022 09:49:30 +0800 From: Kefeng Wang To: , Andrew Morton CC: "Matthew Wilcox (Oracle)" , , Vishal Moola , Kefeng Wang Subject: [PATCH v2] mm: swap: Convert mark_page_lazyfree() to folio_mark_lazyfree() Date: Fri, 9 Dec 2022 10:06:18 +0800 Message-ID: <20221209020618.190306-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221207023431.151008-2-wangkefeng.wang@huawei.com> References: <20221207023431.151008-2-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Queue-Id: A5B22180002 X-Rspamd-Server: rspam01 X-Stat-Signature: uxdye11te5wf9dywa49hhyq3a5rhk9wr X-HE-Tag: 1670550574-440768 X-HE-Meta: U2FsdGVkX1+6vfXbxAd+EfHTtHi1JC0gTlkV5vaZxfgFuftclkFSXjHkgcMtzVTjy7q8aUBOr9IL7Mct82YSbTRjRVqLRsDmPYb48Q1GJAaDHWxreBCbid6WSgPZKTKEcAch0f+X6ILdtHt3iRdWV15h3NqVL1IzR49rHZKC2z1gCK8Qa9cioK1fQHVQmV7OEVgtU2KTzv4rc7BNbgIy9yZsv7h3tPNBj2IWRlIiI7Zesc68sH9WEz+pFCkMbFxVLr9vPGpoPwB6n97GfZyytKo35MCKwoTwiPN+5Sk6trouYhgUGeP//Qi8IOYZAG3R5CfMVjMEEZzEcLL2pJAOS1T/u01f/oTfReJsiBi79zxA1W5sUoNm/2TlnvqDDNBkl1ceJVuFSZ9qDKsPiysDyUdSdZ29SoNOai3Aa3wJg/C67/6X3Z6AhAHM/CUSVwT+HCTiF22ic+CJegeJq0srbld8YWLOiVF9GD18HCBhhgoZQL0kr0JqVnf/ONnVV3SHcUY8XKbdgNKaeFryeSqy7pr2/02mAORiAibvqzxVtjq/q06z5ZidPnusK3I/7u7ONzUhA5h9Dlo/p76YvR/dj4kG4gYIac97aRjz/FSpXTQYkkj/fbz1AXqri/n5dMU3qJMEcUeQsUBt4ppI/qSwqZt/jk6iI/5xETFWC+l2xEmqtBnbP3+vSwwPsjF0nHxjVg7V833X6iaOa59rV8kwQIkVGT8FcHyCvdev/u7BUQdNrD1/u633AFNSc2iOe58dhakyaZpgScu4MhmK9zjuQ04rmxWGHNfzmA8DlORFpDPBwO6WYFsicgL9ghndjA0EkQAan+OsS5uM33p8yHXTdE5COXRLTt/5oiak2k+d8P9Nxa72/X9E1vOP8d2JwYJw/dSieP2WDT+rIHGSXn4p9tSnhYhgnTrnkoIt/Sn7+SEkFPuXxPGuxG42D/xaZsirWL5V7G3DWXZQhi+5KAk +B8rT3hI rDZy6 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: mark_page_lazyfree() and the callers are converted to use folio, this rename and make it to take in a folio argument instead of calling page_folio(). Signed-off-by: Kefeng Wang Reviewed-by: Vishal Moola (Oracle) --- v2: use new name, folio_mark_lazyfree() and drop extern suggested by Vishal Moola include/linux/swap.h | 2 +- mm/huge_memory.c | 2 +- mm/madvise.c | 2 +- mm/swap.c | 12 +++++------- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 2787b84eaf12..93f1cebd8545 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -402,7 +402,7 @@ 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); -extern void mark_page_lazyfree(struct page *page); +void folio_mark_lazyfree(struct folio *folio); extern void swap_setup(void); extern void lru_cache_add_inactive_or_unevictable(struct page *page, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 6e76c770529b..eb17c24c5fda 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1660,7 +1660,7 @@ bool madvise_free_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, tlb_remove_pmd_tlb_entry(tlb, pmd, addr); } - mark_page_lazyfree(&folio->page); + folio_mark_lazyfree(folio); ret = true; out: spin_unlock(ptl); diff --git a/mm/madvise.c b/mm/madvise.c index 87703a19bbef..72565e58e067 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -728,7 +728,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, set_pte_at(mm, addr, pte, ptent); tlb_remove_tlb_entry(tlb, pte, addr); } - mark_page_lazyfree(&folio->page); + folio_mark_lazyfree(folio); } out: if (nr_swap) { diff --git a/mm/swap.c b/mm/swap.c index 70e2063ef43a..5e5eba186930 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -757,16 +757,14 @@ void deactivate_page(struct page *page) } /** - * mark_page_lazyfree - make an anon page lazyfree - * @page: page to deactivate + * folio_mark_lazyfree - make an anon folio lazyfree + * @folio: folio to deactivate * - * mark_page_lazyfree() moves @page to the inactive file list. - * This is done to accelerate the reclaim of @page. + * folio_mark_lazyfree() moves @folio to the inactive file list. + * This is done to accelerate the reclaim of @folio. */ -void mark_page_lazyfree(struct page *page) +void folio_mark_lazyfree(struct folio *folio) { - struct folio *folio = page_folio(page); - if (folio_test_lru(folio) && folio_test_anon(folio) && folio_test_swapbacked(folio) && !folio_test_swapcache(folio) && !folio_test_unevictable(folio)) {