From patchwork Wed May 4 18:28:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12838362 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 EEA0DC433EF for ; Wed, 4 May 2022 18:29:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5667E6B0089; Wed, 4 May 2022 14:29:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDEA76B0085; Wed, 4 May 2022 14:29:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AD636B0085; Wed, 4 May 2022 14:29:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 29DB86B0088 for ; Wed, 4 May 2022 14:29:05 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 01B4912119B for ; Wed, 4 May 2022 18:29:04 +0000 (UTC) X-FDA: 79428897450.02.4D005C7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 7A142140081 for ; Wed, 4 May 2022 18:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=5quld6PgXDQsno1p/cxFOWTDpBSk6Vh4OG/wcGOVDgY=; b=jfVMuiZa1kxC3NWFPYwNDRnGK2 inVKcSmH0ZUnvHJlDFXKliUCs2zqjg2jMylMelBFKgKCiNKTF2okbpOmuMQ6ALSwLlwTBQqvmwpuv 2piPlkl3YngDv+YUjzlnd57kfsVO+7/+A9YLutqYVrAGnAN2ZebQs9OujUNckZ/HhFcZhlW07WZOI jGFRZNa3c4DrxZaXtiB0wVPafVdaia/JJeQxQlLbXeAaC5/nGm9fzfB8LEuvF4E3/MfSygik07BFs GVEugeTFgohKKgdMPEtcwbGIQFKz4cluiFkmGm4W4di096kzxmL8bnsZTu/TF+OzqOHZSCR8JUNrF Z/u3evDg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmJkF-00Gq72-4p; Wed, 04 May 2022 18:29:03 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linuxfoundation.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v2 13/26] vmscan: Convert the activate_locked portion of shrink_page_list to folios Date: Wed, 4 May 2022 19:28:44 +0100 Message-Id: <20220504182857.4013401-14-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220504182857.4013401-1-willy@infradead.org> References: <20220504182857.4013401-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: ikpwme5npmdefytm7qpks38czaxqn3um X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7A142140081 X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=jfVMuiZa; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1651688942-201497 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: This accounts the number of pages activated correctly for large folios. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/vmscan.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 9ac2583ca5e5..85c9758f6f32 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1927,15 +1927,16 @@ static unsigned int shrink_page_list(struct list_head *page_list, } activate_locked: /* Not a candidate for swapping, so reclaim swap space. */ - if (PageSwapCache(page) && (mem_cgroup_swap_full(page) || - PageMlocked(page))) - try_to_free_swap(page); - VM_BUG_ON_PAGE(PageActive(page), page); - if (!PageMlocked(page)) { - int type = page_is_file_lru(page); - SetPageActive(page); + if (folio_test_swapcache(folio) && + (mem_cgroup_swap_full(&folio->page) || + folio_test_mlocked(folio))) + try_to_free_swap(&folio->page); + VM_BUG_ON_FOLIO(folio_test_active(folio), folio); + if (!folio_test_mlocked(folio)) { + int type = folio_is_file_lru(folio); + folio_set_active(folio); stat->nr_activate[type] += nr_pages; - count_memcg_page_event(page, PGACTIVATE); + count_memcg_folio_events(folio, PGACTIVATE, nr_pages); } keep_locked: unlock_page(page);