From patchwork Mon Aug 26 14:41:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13777970 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 104C5C5321E for ; Mon, 26 Aug 2024 14:41:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4681A6B007B; Mon, 26 Aug 2024 10:41:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F1356B0082; Mon, 26 Aug 2024 10:41:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 291E26B0083; Mon, 26 Aug 2024 10:41:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 089536B007B for ; Mon, 26 Aug 2024 10:41:34 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5DCA7140D1F for ; Mon, 26 Aug 2024 14:41:33 +0000 (UTC) X-FDA: 82494660066.23.C400B45 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf14.hostedemail.com (Postfix) with ESMTP id 6049F100013 for ; Mon, 26 Aug 2024 14:41:29 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 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=1724683249; 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=/Cv2C385RLVH9jMQqyNE60G67h74506pRdSXlqFlpvE=; b=vAuFANaiV1FxVqRQLkuqYHCDDXgvd54hK07ofKS8VS/IN+OmNhVa2RVSJjvjx1E1gedxzv Tw5PeYx29idR/2lsC4UI08x2YbTMGKX0Ppoew/KJbE2sz7Z+syaDl1CCZJDA9sEWMFMabw W4tme4OpYhtLHHfiU8TxrhwNzrk16Zc= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 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=1724683249; a=rsa-sha256; cv=none; b=BY9aBIbrxJH79fyBkG44n26MGOv8MZ5Mdu4AKz8DoQ7ULJ4F5leIvkH0vjzHqV/yEVargT jSJJntxi0TGqT1AYaWZX4gZc5kIADVb6FU2BeuYzALSrj2njlHJN8/A3fOHp7FFPZuHxoS gex6i0K1fgYZyw7004jwrx0GxENAftA= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wstf43XdPz1j7Jw; Mon, 26 Aug 2024 22:41:16 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 434711401F3; Mon, 26 Aug 2024 22:41:25 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 26 Aug 2024 22:41:24 +0800 From: Kefeng Wang To: Andrew Morton CC: David Hildenbrand , Matthew Wilcox , Baolin Wang , Zi Yan , Alistair Popple , Jonathan Corbet , , Kefeng Wang Subject: [PATCH 5-fix/6] mm: remove isolate_lru_page() fix Date: Mon, 26 Aug 2024 22:41:14 +0800 Message-ID: <20240826144114.1928071-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240826065814.1336616-6-wangkefeng.wang@huawei.com> References: <20240826065814.1336616-6-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 6049F100013 X-Stat-Signature: 7x76d3txig8b36h5oiwz6p7zz16bn78f X-HE-Tag: 1724683289-423173 X-HE-Meta: U2FsdGVkX18Y2Oh1FZXYVPivZgKotsjNDGqEKf5Wbc3DXfUuZgcAdE8inuhoGlGBHYgsdlinCzG3iDpXy+EWK39yVqSpTxgF9CprcYTeuZE4SWrBOcQ2ZgFYD5lA+sffchIHqSvjn93VEphc1jrqV8gd1xD+1PLFnviQV5ulfGMLdqjTA19Hh/cnR+I4tg9aPNw2BKjEuPRRJ4guS9u98bCL2fCHC3ey1o3M8isWVnLF5yvlS37tVL4XAJSmkakEyBjB0DpVLNvszqbhQe8AM8TcA+1CEJMfNhSwEmdsNZlsU8Y6hP0Sm7/LYGUyNv1V0PkzfizBn2VlUKiq1hoxjOsUAxLDMAiFKIWRw2nivevpHuZbGT5iPBjz11W9kymlZNOpSqND7wbavgGBuhlHsk8uS8AJBKakVHe7PczPMkH185qd2iszgAzPzg4eTDHnNcwLaPZ8WkOqBSO+bEmJaAYrPwIyqll6nnzvE2/HlVrr59mEVs8s9nYOUKqb70K6aFvrY2/ZTOezD7oGhEKP+EyYRflLjQ7aaqMyy6K42B5kfel60GS7xwoAnyj5NNoC1DjhmSzmKrcecF5W7q59UVpyGZCISuGSfNTdPGybC3tzE61MAqtNUPVQa6VL2Mu4K6DJ+DiXzFYmqPhFi3MOYgCpRCQMtoQ8ujPXs8yh0lzF6qZ8+8LKbKNsuMHaYkkz7zmQQu70hfmuxyqwaXOUp72DkyBg8/h5r46ATUDfNf6JTYs0tGJO+uMSH9tjD0CtZnSuCNqx+ERiCWtzsr6bkKvtpzOYiL24yDYRB0g1rBGnSoqtiP1V8Ba1AH02nYnbXAHHg6UwM6lSn6r62O05Mnqb5Fvaq1wbWv6/uC6Aw9sv4gtlgdiKZV0GOrb6OKSb6nVK1nwcicMHxY+6L78RSoVbVrALiQyFbrHy2ar4e0jMdutAFjznskU9A8TqlMflXkn1orYUQRBjgo2cqdr LbXZr111 xNiecfM+Vf2YtfLfLEcTaFJwyIZsRsyDu4dMmtXMgGvzNV9uyClLbBIcTqsiF67BOwgs/+sxLPGd3hOpo27FFcTNWp14H1uKXQQRR3cYulkfXG8mWVaEQJ+hiZ3Zbt4EfcuUSZr+6UcyGEY7DRNg5fPMcdDV6e7AX6zIUqCVlbz5paTt1qMtSxaTOhzRA5dtEDZ+c 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: List-Subscribe: List-Unsubscribe: Convert page to folio in comment and document, per Matthew. Signed-off-by: Kefeng Wang Reviewed-by: Vishal Moola (Oracle) --- Andrew, Please help to squash this fix into [PATCH 5/6] mm: remove isolate_lru_page(). Documentation/mm/page_migration.rst | 18 +++++++++--------- Documentation/mm/unevictable-lru.rst | 2 +- mm/khugepaged.c | 2 +- mm/migrate_device.c | 4 ++-- mm/swap.c | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Documentation/mm/page_migration.rst b/Documentation/mm/page_migration.rst index 0046bbbdc65d..519b35a4caf5 100644 --- a/Documentation/mm/page_migration.rst +++ b/Documentation/mm/page_migration.rst @@ -63,15 +63,15 @@ and then a low level description of how the low level details work. In kernel use of migrate_pages() ================================ -1. Remove pages from the LRU. +1. Remove folios from the LRU. - Lists of pages to be migrated are generated by scanning over - pages and moving them into lists. This is done by + Lists of folios to be migrated are generated by scanning over + folios and moving them into lists. This is done by calling folio_isolate_lru(). - Calling folio_isolate_lru() increases the references to the page - so that it cannot vanish while the page migration occurs. + Calling folio_isolate_lru() increases the references to the folio + so that it cannot vanish while the folio migration occurs. It also prevents the swapper or other scans from encountering - the page. + the folio. 2. We need to have a function of type new_folio_t that can be passed to migrate_pages(). This function should figure out @@ -84,10 +84,10 @@ In kernel use of migrate_pages() How migrate_pages() works ========================= -migrate_pages() does several passes over its list of pages. A page is moved -if all references to a page are removable at the time. The page has +migrate_pages() does several passes over its list of folios. A folio is moved +if all references to a folio are removable at the time. The folio has already been removed from the LRU via folio_isolate_lru() and the refcount -is increased so that the page cannot be freed while page migration occurs. +is increased so that the folio cannot be freed while folio migration occurs. Steps: diff --git a/Documentation/mm/unevictable-lru.rst b/Documentation/mm/unevictable-lru.rst index 04113c2a2f9e..8d11fe6a0854 100644 --- a/Documentation/mm/unevictable-lru.rst +++ b/Documentation/mm/unevictable-lru.rst @@ -80,7 +80,7 @@ on an additional LRU list for a few reasons: (2) We want to be able to migrate unevictable folios between nodes for memory defragmentation, workload management and memory hotplug. The Linux kernel can only migrate folios that it can successfully isolate from the LRU - lists (or "Movable" pages: outside of consideration here). If we were to + lists (or "Movable" folios: outside of consideration here). If we were to maintain folios elsewhere than on an LRU-like list, where they can be detected by folio_isolate_lru(), we would prevent their migration. diff --git a/mm/khugepaged.c b/mm/khugepaged.c index b87eacfac5a7..ab646018ce25 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -628,7 +628,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma, /* * We can do it before folio_isolate_lru because the - * page can't be freed from under us. NOTE: PG_lock + * folio can't be freed from under us. NOTE: PG_lock * is needed to serialize against split_huge_page * when invoked from the VM. */ diff --git a/mm/migrate_device.c b/mm/migrate_device.c index f1faff058491..8d687de88a03 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -328,8 +328,8 @@ static bool migrate_vma_check_page(struct page *page, struct page *fault_page) /* * One extra ref because caller holds an extra reference, either from - * folio_isolate_lru() for a regular page, or migrate_vma_collect() for - * a device page. + * folio_isolate_lru() for a regular folio, or migrate_vma_collect() for + * a device folio. */ int extra = 1 + (page == fault_page); diff --git a/mm/swap.c b/mm/swap.c index 634fde80cd44..510573d7e82e 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -906,8 +906,8 @@ atomic_t lru_disable_count = ATOMIC_INIT(0); /* * lru_cache_disable() needs to be called before we start compiling - * a list of pages to be migrated using folio_isolate_lru(). - * It drains pages on LRU cache and then disable on all cpus until + * a list of folios to be migrated using folio_isolate_lru(). + * It drains folios on LRU cache and then disable on all cpus until * lru_cache_enable is called. * * Must be paired with a call to lru_cache_enable().