From patchwork Mon Jan 30 21:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 13121908 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 55CC2C636D7 for ; Mon, 30 Jan 2023 21:44:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 477F86B0078; Mon, 30 Jan 2023 16:44:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DB656B007B; Mon, 30 Jan 2023 16:44:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 288656B007D; Mon, 30 Jan 2023 16:44:02 -0500 (EST) 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 0C00A6B0078 for ; Mon, 30 Jan 2023 16:44:02 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C9756120BDC for ; Mon, 30 Jan 2023 21:44:01 +0000 (UTC) X-FDA: 80412793482.05.04E815E Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf11.hostedemail.com (Postfix) with ESMTP id E427A4000B for ; Mon, 30 Jan 2023 21:43:59 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GGZic+Sg; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1675115040; a=rsa-sha256; cv=none; b=VsxLwOGsrlXd+gwMkMuRbS2WqV4aXzi105UIEBfAlwIvyCfGQx5KcAuYlchOdmDdzkYtJi 8Kks7rkGXA1kfLbIyhnAM0IomDc1o3Psi8TeT3qxOJ3mb42DC8GxtQCZVV8IuTVPlyRsIS bMXrq2oWV5U4ulfZ3MN3BuVGf2VtxzI= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GGZic+Sg; spf=pass (imf11.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.214.169 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=1675115040; 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=4UBov3sv7172TVhYTWoSlpD7u+6AtPn48Pn1/2ZA2fU=; b=Qpn7F7ykH0OzVArCTgx8lukF1joPCN+BzFNSutKgh+v/A4VZy/1B8iHvLC3IjMy6xjSCit hzYAtUIrn5rVqqS059H8F5RuCf8IHnDkAkuN4KSEiKRIGvqRxkdDVie+nni4bA934QJZ5t E8YhQBBqZkZrEf0/dMZfObhcAWMMCmI= Received: by mail-pl1-f169.google.com with SMTP id m2so8087472plg.4 for ; Mon, 30 Jan 2023 13:43:59 -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=4UBov3sv7172TVhYTWoSlpD7u+6AtPn48Pn1/2ZA2fU=; b=GGZic+SgYRe3M4jfPhEI4uBwZjpwo1LVgsuMKjaYJEcaof28Rdl8bIcKFRGFMOo/v1 vp0jipI83f4E8yLw84AyXoFw7/AEoOEMI+BoFH6TyK7yw5bqlH0Folia7f0LDUPXUSJE sY+zofDSWUUjnW10KVNYHPtOqTI6aPq7W30CZzkt0G3OGeXkeyWsvPP7iC9ue60m7d00 bjlF3UiLdcksT0VkBZi8djwpFJHz2Xc6LE1uP9ILm9lxEvvt1RGL5cpq++cvkTHcL/Vo SYDFpZ+xHAZLbBBZjx6hjNav9fmIUKe+EZvnLPpHqhYQ6AeAvHnAJyrSodxo/+yBRygT JotA== 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=4UBov3sv7172TVhYTWoSlpD7u+6AtPn48Pn1/2ZA2fU=; b=fTKgcUH4eP6M9/XpOQLt01CGo5kKmksB3QtnN2xVof8gkBEKOIq6SkPrfEfGYG+cYr +8/sRh3RLB7oHEe52nia2JY1s/uIyih56rTC9nlJX4k3QMERxJvquxh/ACADsr3EME22 UF+Xg8ClSCILaJByvOGddf6StVkv+6Hk6741j8CT0k8+GeqFVTvOfGk59YRGxvsQMY3E GasJZrGPg0GM/1o/HE1Puk0Rm4pEk/E6AOsriMjhJAW+WzRHcyviVDj0m6CEKq+6XSCD gOpfyW/7qXr///RQHv0CICnhFmRGXbUqDr0dMqVSe7L8xEb5egY7h7CQ3P228r4pKEIg 4LUQ== X-Gm-Message-State: AO0yUKVgmpCv8mo4PSu38mArYvs7WRKJlJu4dljYHpIrAlp12SQsKx+2 GGT2NGbO8awQeAYYFakY1tOmytGtgYE= X-Google-Smtp-Source: AK7set/TKhPV3YcjWGwxjEFSpRV7C5X/JGvIQRGhQ6P+HCTujOoxc+xfB2YEufD5hkNCey2k4eu/Tw== X-Received: by 2002:a17:90b:1b48:b0:22c:59c3:869a with SMTP id nv8-20020a17090b1b4800b0022c59c3869amr11510265pjb.21.1675115038671; Mon, 30 Jan 2023 13:43:58 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:937f:7f20::a8cd]) by smtp.googlemail.com with ESMTPSA id d5-20020a17090a628500b0022bbad75af6sm25156403pjj.1.2023.01.30.13.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:43:58 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH mm-unstable v2 4/4] mm/migrate: Convert putback_movable_pages() to use folios Date: Mon, 30 Jan 2023 13:43:52 -0800 Message-Id: <20230130214352.40538-5-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230130214352.40538-1-vishal.moola@gmail.com> References: <20230130214352.40538-1-vishal.moola@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: E427A4000B X-Rspamd-Server: rspam01 X-Stat-Signature: xznp8ognyy7dg563az6p1x9ch8dreyfc X-HE-Tag: 1675115039-435771 X-HE-Meta: U2FsdGVkX19A6nhhg/mJc4vPVzcT9nKEQV7fgBLcWuEPEdCSnrFoqEgxW2cfbdR5dzm0DhU8sb+pbamE050En2d2TbNOZrEy3Z10MlhY/ojuamsKmkyBL+nSvon9EM/NZAbOFJ+FjRYAB++tJpjgXfizzbZkAtvLkXe3F/F+kajInji9U+DJaO8lfdAQ2i41SykYRSRxg9ZyxuMxguAZE0FItV4EmGFPo8ztxADsCyAYoMLjaUeey+nVcTYBuX9DEs2mSTLqgdPJ2MBSSot67AhCBw5mcJqacBxRfk59pgTXR3/wBHwAzFknjLqsFDjtRK62pWE6LvX0p1eQnoe434O34SEAYdDOlABDIo+jQLT9bUawG2FyHcQxw/AWCUK0MywJQeDxeAbuAI3Ibs/5syxxlfz6cmrcD5oLJUH5K1Y8aIUPD2tnUTphK31kqnArH3K+8FuyskvLb6t5drsYGMvu+OIYt768xqkdjS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9B1AB8cRwlv1j9U0ffA== 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: Removes 6 calls to compound_head(), and replaces putback_movable_page() with putback_movable_folio() as well. Signed-off-by: Vishal Moola (Oracle) --- mm/migrate.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index c20d9f531db4..db480dc08bac 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -129,12 +129,12 @@ int isolate_movable_page(struct page *page, isolate_mode_t mode) return -EBUSY; } -static void putback_movable_page(struct page *page) +static void putback_movable_folio(struct folio *folio) { - const struct movable_operations *mops = page_movable_ops(page); + const struct movable_operations *mops = folio_movable_ops(folio); - mops->putback_page(page); - ClearPageIsolated(page); + mops->putback_page(&folio->page); + folio_clear_isolated(folio); } /* @@ -147,33 +147,33 @@ static void putback_movable_page(struct page *page) */ void putback_movable_pages(struct list_head *l) { - struct page *page; - struct page *page2; + struct folio *folio; + struct folio *folio2; - list_for_each_entry_safe(page, page2, l, lru) { - if (unlikely(PageHuge(page))) { - folio_putback_active_hugetlb(page_folio(page)); + list_for_each_entry_safe(folio, folio2, l, lru) { + if (unlikely(folio_test_hugetlb(folio))) { + folio_putback_active_hugetlb(folio); continue; } - list_del(&page->lru); + list_del(&folio->lru); /* - * We isolated non-lru movable page so here we can use - * __PageMovable because LRU page's mapping cannot have + * We isolated non-lru movable folio so here we can use + * __PageMovable because LRU folio's mapping cannot have * PAGE_MAPPING_MOVABLE. */ - if (unlikely(__PageMovable(page))) { - VM_BUG_ON_PAGE(!PageIsolated(page), page); - lock_page(page); - if (PageMovable(page)) - putback_movable_page(page); + if (unlikely(__folio_test_movable(folio))) { + VM_BUG_ON_FOLIO(!folio_test_isolated(folio), folio); + folio_lock(folio); + if (folio_test_movable(folio)) + putback_movable_folio(folio); else - ClearPageIsolated(page); - unlock_page(page); - put_page(page); + folio_clear_isolated(folio); + folio_unlock(folio); + folio_put(folio); } else { - mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + - page_is_file_lru(page), -thp_nr_pages(page)); - putback_lru_page(page); + node_stat_mod_folio(folio, NR_ISOLATED_ANON + + folio_is_file_lru(folio), -folio_nr_pages(folio)); + folio_putback_lru(folio); } } }