Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3474793rwb; Fri, 20 Jan 2023 17:07:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXtNkGlTPdBWs4MpKYs5wI7O4qawzE+/a1HXQO4k0sWRUBPUKvEZ3BuBc5+bErr7ibSLp63O X-Received: by 2002:a17:902:b702:b0:186:8568:be7e with SMTP id d2-20020a170902b70200b001868568be7emr17857842pls.15.1674263279743; Fri, 20 Jan 2023 17:07:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674263279; cv=none; d=google.com; s=arc-20160816; b=NOYOybWQPvhvp6RrU0DgTogay1vNRjPwm6mimygo4Xibhx3qo7ZnIZ0QKdTynnuVfG mitZ0UgsV0WaOwjIMAWowjUmgUXI3k3c0oUbsBSS1/F1h287zWDivABK1goq5WogU3qJ 5QTscEbkfpaO2omAPUsFDMqNpV85yluniwR8MkQQCnkQJS2r/FAmIAsmK78+nR21OIxd 46SufexJ210OEFgQK1W7mFUXtuAwpCTUZfsacpG2zrdYT2A7odmwIbOZoe8Srfp0AQsF W70CPGgjqCGiFAXlcI8LOIbB8ZywlAI1VtlBsg5LUHNLwKBh9qHmPTrz05wR6rMM+LrW iFvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dkXNorFtaPaGzwVFxzbZYEJpEcyIIYNIa70AwU0RnhU=; b=IBs83IdOivRXMk2HfLhkfqe08u+b3fw652aCWV+ZZ0b6Y/KR0jjeGsjNmpWYKfNmj8 sW5eZh8zAbcAGyTycbszAucsJ6R4YrUWML5hi9fGJczCMu2S0ulQFSPRTVHlch7L/EhO IWykB4FiC16fomuz9joM6zE5YSGARY6tICh55665d0MaFMHpM5Wdk2kJxCRK1qtU1lg9 yxuLQZD9Iyyr8dqFNcqVowu1ucGP3A7pnIjcY+5XlntPRkLbTym3FKCrokypM7erVIjQ Av2h+lwDhfGDdZVKrEzRIvxLXlIaNui4gPqThx6Bjqkc137YmZDhwke0lDVsBbW/kc61 LeUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OU6CzD7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a170902d2cd00b0019475cb683asi26794732plc.584.2023.01.20.17.07.53; Fri, 20 Jan 2023 17:07:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OU6CzD7S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229823AbjAUA4h (ORCPT + 50 others); Fri, 20 Jan 2023 19:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjAUA4e (ORCPT ); Fri, 20 Jan 2023 19:56:34 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97925E501 for ; Fri, 20 Jan 2023 16:56:29 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id lp10so3692967pjb.4 for ; Fri, 20 Jan 2023 16:56:29 -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=dkXNorFtaPaGzwVFxzbZYEJpEcyIIYNIa70AwU0RnhU=; b=OU6CzD7S2SXTi5dHeizCrqqyUa1E/S+1Xv9bL5KSlTsI2aFqfbefk+2ycerfdqRxhd 8YL3QZPjVDil05FoKXdnkZJjlW1wZfZPKVWdilIvw6LAdMo78a/ZgtD8F38roE33chrj EDi3VXK72Xts3yjaN/uxM+sQX+sQbp/Di+qqF+y7yobNFU0OdyB/pAGlAEsC/w++utef 7X8rd3cChqG32EgfywmG6uXNbzbZR5ID0ImPlRoXIyh9MtEZiPhonzrYEKh39xMdXuxq 8DghFm+3fyJVrZaAqCFZaTrMx4Uv8bjEvvF1/GOqE0IfHkDQG2KN3Mn6aaJQ9nNH65zm kHWQ== 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=dkXNorFtaPaGzwVFxzbZYEJpEcyIIYNIa70AwU0RnhU=; b=L5Wua0ze37PCP6jncMHhmK5AqYUyyfXbvAy4YADjthN7XreR+S2LbGoKInsD3UZZBI Fm3D5QryGe5QW1QSnJWWhhRpfpjB/bkoabUy3k5KoTgVJRog59tQ0LFHMyRG49Pm5iFy 9CWw+acjtG0PU8ovr0XVZy4XNeWE0eNWIAEeCUXlZjepaJTbo5D8nqUz3HfXicbWptVv MuGFEx02/e6Irk/tC1HgTX69aIoqLQP7xkemAzRUAzM21LmBzhq8p0YFLKS08pXgQhnC Kf55tQCd6zSOq4VkBAJalr80fmBJa51T+d7gif7j6PzXC7bjS5Af2gOnAOB61AGjLHjj rd0Q== X-Gm-Message-State: AFqh2krC27to+VQlnXmZKoNk+xcOghLbPFtbIn5E+p13jFMC3rG+5pbX 5cOZ11rtwpsVuz09vJLCEXk= X-Received: by 2002:a17:90a:7309:b0:228:e521:3430 with SMTP id m9-20020a17090a730900b00228e5213430mr17656529pjk.21.1674262589164; Fri, 20 Jan 2023 16:56:29 -0800 (PST) Received: from fedora.hsd1.ca.comcast.net ([2601:644:8002:1c20::4e4b]) by smtp.googlemail.com with ESMTPSA id pc3-20020a17090b3b8300b001fde655225fsm11314371pjb.2.2023.01.20.16.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 16:56:28 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, willy@infradead.org, sidhartha.kumar@oracle.com, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH 3/3] mm/migrate: Convert putback_movable_pages() to use folios Date: Fri, 20 Jan 2023 16:56:22 -0800 Message-Id: <20230121005622.57808-4-vishal.moola@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230121005622.57808-1-vishal.moola@gmail.com> References: <20230121005622.57808-1-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Removes 6 calls to compound_head(), and replaces putback_movable_page() with putback_movable_folio() as well. Suggested-by: Matthew Wilcox (Oracle) 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 bcde3cbbc8c9..de65f7146ee6 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))) { - putback_active_hugepage(page); + list_for_each_entry_safe(folio, folio2, l, lru) { + if (unlikely(folio_test_hugetlb(folio))) { + putback_active_hugepage(&folio->page); 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); } } } -- 2.38.1