From mboxrd@z Thu Jan 1 00:00:00 1970 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 4961CC433EF for ; Fri, 4 Feb 2022 20:00:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C677B8D000C; Fri, 4 Feb 2022 14:59:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B03578D0012; Fri, 4 Feb 2022 14:59:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F6438D0016; Fri, 4 Feb 2022 14:59:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id DD3828D0008 for ; Fri, 4 Feb 2022 14:59:08 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A289318205800 for ; Fri, 4 Feb 2022 19:59:08 +0000 (UTC) X-FDA: 79106161176.29.7CB267B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP id 491EEA0008 for ; Fri, 4 Feb 2022 19:59:08 +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=CHhZ25O3OhV0N7J2wADYsEBTBy/Oulpk6Xzyr7aEGBI=; b=MFx1C5bt5C/1e6O7AB7bbfzcRk sCTuR0iR2fgIYTF0/50HMiQ0Fbpmjxy8K5/pMFhv5jKqkMbO5nzo2j5h0k+B4DIrEOKoZhi5oaVcR S5a6wL8ibGa9QvcFoPeegAUyIbY6v5akkNddZTscLh75dLc59cLKtxGwsKtw29FzGFYBkPqa+dbCW RrcOPUvARw7dhCDYIvVrHeh3/CFD1f2GQ7q9eVdJs7TGxomdlNsGHUDG3+KW+tnnJmSJ0XQ94FNOj AUtTOxfB6+NpHA+j+6GdgUEfJBThipsBeBvdHSjti/zs3V3Acl1+QHqGku6KMCtq2Uue0u/24xvqw iCaX5crA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nG4ja-007LqE-TP; Fri, 04 Feb 2022 19:59:06 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH 63/75] mm/vmscan: Account large folios correctly Date: Fri, 4 Feb 2022 19:58:40 +0000 Message-Id: <20220204195852.1751729-64-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220204195852.1751729-1-willy@infradead.org> References: <20220204195852.1751729-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 491EEA0008 X-Stat-Signature: n63ut5uiakd7yk779a5m3bsn8fpidct6 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=MFx1C5bt; dmarc=none; spf=none (imf15.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: 1644004748-949394 Content-Transfer-Encoding: quoted-printable 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: The statistics we gather should count the number of pages, not the number of folios. The logic in this function is somewhat convoluted, but even if we split the folio, I think the accounting is now correct. Signed-off-by: Matthew Wilcox (Oracle) --- mm/vmscan.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index edcca2424eaa..5ceed53cb326 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1568,10 +1568,10 @@ static unsigned int shrink_page_list(struct list_= head *page_list, */ folio_check_dirty_writeback(folio, &dirty, &writeback); if (dirty || writeback) - stat->nr_dirty++; + stat->nr_dirty +=3D nr_pages; =20 if (dirty && !writeback) - stat->nr_unqueued_dirty++; + stat->nr_unqueued_dirty +=3D nr_pages; =20 /* * Treat this page as congested if the underlying BDI is or if @@ -1583,7 +1583,7 @@ static unsigned int shrink_page_list(struct list_he= ad *page_list, if (((dirty || writeback) && mapping && inode_write_congested(mapping->host)) || (writeback && PageReclaim(page))) - stat->nr_congested++; + stat->nr_congested +=3D nr_pages; =20 /* * If a page at the tail of the LRU is under writeback, there @@ -1632,7 +1632,7 @@ static unsigned int shrink_page_list(struct list_he= ad *page_list, if (current_is_kswapd() && PageReclaim(page) && test_bit(PGDAT_WRITEBACK, &pgdat->flags)) { - stat->nr_immediate++; + stat->nr_immediate +=3D nr_pages; goto activate_locked; =20 /* Case 2 above */ @@ -1650,7 +1650,7 @@ static unsigned int shrink_page_list(struct list_he= ad *page_list, * and it's also appropriate in global reclaim. */ SetPageReclaim(page); - stat->nr_writeback++; + stat->nr_writeback +=3D nr_pages; goto activate_locked; =20 /* Case 3 above */ @@ -1816,7 +1816,7 @@ static unsigned int shrink_page_list(struct list_he= ad *page_list, case PAGE_ACTIVATE: goto activate_locked; case PAGE_SUCCESS: - stat->nr_pageout +=3D thp_nr_pages(page); + stat->nr_pageout +=3D nr_pages; =20 if (PageWriteback(page)) goto keep; --=20 2.34.1