Skip to content

Commit c79b7b9

Browse files
author
Matthew Wilcox (Oracle)
committed
mm/vmscan: Account large folios correctly
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) <[email protected]>
1 parent 343b288 commit c79b7b9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mm/vmscan.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,10 +1575,10 @@ static unsigned int shrink_page_list(struct list_head *page_list,
15751575
*/
15761576
folio_check_dirty_writeback(folio, &dirty, &writeback);
15771577
if (dirty || writeback)
1578-
stat->nr_dirty++;
1578+
stat->nr_dirty += nr_pages;
15791579

15801580
if (dirty && !writeback)
1581-
stat->nr_unqueued_dirty++;
1581+
stat->nr_unqueued_dirty += nr_pages;
15821582

15831583
/*
15841584
* Treat this page as congested if the underlying BDI is or if
@@ -1590,7 +1590,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
15901590
if (((dirty || writeback) && mapping &&
15911591
inode_write_congested(mapping->host)) ||
15921592
(writeback && PageReclaim(page)))
1593-
stat->nr_congested++;
1593+
stat->nr_congested += nr_pages;
15941594

15951595
/*
15961596
* If a page at the tail of the LRU is under writeback, there
@@ -1639,7 +1639,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
16391639
if (current_is_kswapd() &&
16401640
PageReclaim(page) &&
16411641
test_bit(PGDAT_WRITEBACK, &pgdat->flags)) {
1642-
stat->nr_immediate++;
1642+
stat->nr_immediate += nr_pages;
16431643
goto activate_locked;
16441644

16451645
/* Case 2 above */
@@ -1657,7 +1657,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
16571657
* and it's also appropriate in global reclaim.
16581658
*/
16591659
SetPageReclaim(page);
1660-
stat->nr_writeback++;
1660+
stat->nr_writeback += nr_pages;
16611661
goto activate_locked;
16621662

16631663
/* Case 3 above */
@@ -1823,7 +1823,7 @@ static unsigned int shrink_page_list(struct list_head *page_list,
18231823
case PAGE_ACTIVATE:
18241824
goto activate_locked;
18251825
case PAGE_SUCCESS:
1826-
stat->nr_pageout += thp_nr_pages(page);
1826+
stat->nr_pageout += nr_pages;
18271827

18281828
if (PageWriteback(page))
18291829
goto keep;

0 commit comments

Comments
 (0)