From nobody Mon Jun 15 22:00:12 2026 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA0323B7751 for ; Tue, 14 Apr 2026 09:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158178; cv=none; b=qXls/fcKpXgAUudvNb5AxPfxB0xtF1oNr95slapFlZHbwgN1Ot8NdEa5RZ/MoYAsUs1w1mdy61cPIFte1dzvDmT8QRN/KXPoYoXSeRY28uSg5TvwbLywJOb5qwvnaJa3NlwbvrbSZVEFeWL+DZkXjUGR8L+duvijgKwxrsNfu/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158178; c=relaxed/simple; bh=TZ7tyhV0Or+wnbgLUQgLKLLZWUO2JrR236fhabcxkeg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WpTI6Sx0XA83wQFlreKRy7Hb1bXJd1X08r3Xpq7vs27SpOlYSFNcpzQLRHCK3VqM0CDCUiCtOw3iDwUM/WWhENsbuQSdjqv0/IWYK+WQAqNJsRv1mJNi5nJksCAxVULW+8/7b3LlJvhb5sKEz1PWU59bT5udIJ64qDRaFhABRUE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xKD7OtXc; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xKD7OtXc" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776158172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ubfySRhL7H2ALfoVfoAbTG+vWRfRjBu73p+puM1I0vE=; b=xKD7OtXcIsrwj1A0b0Itu601MKl/5NJ+Z0FGvgmv1pfr3euBdkog0LGDvJBe4hIkNDVTku mgSwNGLQjVUnIbnhuBdwF9V3qaKkp+SUraT5C3qywZ9fdaiGetCOGQPw5x4h6xn9mE+JFw 1PF6B8WPGUWQtCNRt1t5U+XM/AdVoLM= From: Ye Liu To: Trond Myklebust , Anna Schumaker , Andrew Morton , Vlastimil Babka , David Hildenbrand , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" , Chris Li , Kairui Song Cc: Ye Liu , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , Jason Gunthorpe , John Hubbard , Peter Xu , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/4] mm/vmstat: use node_stat_add_folio/sub_folio for folio_nr_pages operations Date: Tue, 14 Apr 2026 17:15:18 +0800 Message-ID: <20260414091527.2970844-2-ye.liu@linux.dev> In-Reply-To: <20260414091527.2970844-1-ye.liu@linux.dev> References: <20260414091527.2970844-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu Replace node_stat_mod_folio() calls that pass folio_nr_pages(folio) or -folio_nr_pages(folio) as the third argument with the more concise node_stat_add_folio() and node_stat_sub_folio() functions respectively. This makes the code more readable and reduces the number of arguments passed to these functions. Signed-off-by: Ye Liu --- fs/nfs/internal.h | 2 +- fs/nfs/write.c | 2 +- mm/compaction.c | 5 ++--- mm/gup.c | 5 ++--- mm/khugepaged.c | 10 ++++------ mm/mempolicy.c | 5 ++--- mm/migrate.c | 12 +++++------- mm/page-writeback.c | 4 ++-- mm/swap_state.c | 4 ++-- 9 files changed, 21 insertions(+), 28 deletions(-) diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index fc5456377160..f5c52a2d2a1f 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h @@ -858,7 +858,7 @@ static inline void nfs_folio_mark_unstable(struct folio= *folio, /* This page is really still in write-back - just that the * writeback is happening on the server now. */ - node_stat_mod_folio(folio, NR_WRITEBACK, nr); + node_stat_add_folio(folio, NR_WRITEBACK); bdi_wb_stat_mod(inode, WB_WRITEBACK, nr); __mark_inode_dirty(inode, I_DIRTY_DATASYNC); } diff --git a/fs/nfs/write.c b/fs/nfs/write.c index cc02b57de3c7..a8700824a61b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -871,7 +871,7 @@ static void nfs_folio_clear_commit(struct folio *folio) if (folio) { long nr =3D folio_nr_pages(folio); =20 - node_stat_mod_folio(folio, NR_WRITEBACK, -nr); + node_stat_sub_folio(folio, NR_WRITEBACK); bdi_wb_stat_mod(folio->mapping->host, WB_WRITEBACK, -nr); } } diff --git a/mm/compaction.c b/mm/compaction.c index 3648ce22c807..d7ce622aeed1 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1215,9 +1215,8 @@ isolate_migratepages_block(struct compact_control *cc= , unsigned long low_pfn, =20 /* Successfully isolated */ lruvec_del_folio(lruvec, folio); - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - folio_nr_pages(folio)); + node_stat_add_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); =20 isolate_success: list_add(&folio->lru, &cc->migratepages); diff --git a/mm/gup.c b/mm/gup.c index ad9ded39609c..2cb2efa20bff 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2304,9 +2304,8 @@ static unsigned long collect_longterm_unpinnable_foli= os( continue; =20 list_add_tail(&folio->lru, movable_folio_list); - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - folio_nr_pages(folio)); + node_stat_add_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); } =20 return collected; diff --git a/mm/khugepaged.c b/mm/khugepaged.c index b8452dbdb043..f662de753305 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -502,9 +502,8 @@ void __khugepaged_exit(struct mm_struct *mm) =20 static void release_pte_folio(struct folio *folio) { - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - -folio_nr_pages(folio)); + node_stat_sub_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); folio_unlock(folio); folio_putback_lru(folio); } @@ -650,9 +649,8 @@ static enum scan_result __collapse_huge_page_isolate(st= ruct vm_area_struct *vma, result =3D SCAN_DEL_PAGE_LRU; goto out; } - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - folio_nr_pages(folio)); + node_stat_add_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); VM_BUG_ON_FOLIO(folio_test_lru(folio), folio); =20 diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 4e4421b22b59..1c413f66b35f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1259,9 +1259,8 @@ static bool migrate_folio_add(struct folio *folio, st= ruct list_head *foliolist, if ((flags & MPOL_MF_MOVE_ALL) || !folio_maybe_mapped_shared(folio)) { if (folio_isolate_lru(folio)) { list_add_tail(&folio->lru, foliolist); - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - folio_nr_pages(folio)); + node_stat_add_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); } else { /* * Non-movable folio may reach here. And, there may be diff --git a/mm/migrate.c b/mm/migrate.c index 8a64291ab5b4..dc8cfee37a70 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -268,8 +268,8 @@ void putback_movable_pages(struct list_head *l) if (unlikely(page_has_movable_ops(&folio->page))) { putback_movable_ops_page(&folio->page); } else { - node_stat_mod_folio(folio, NR_ISOLATED_ANON + - folio_is_file_lru(folio), -folio_nr_pages(folio)); + node_stat_sub_folio(folio, NR_ISOLATED_ANON + + folio_is_file_lru(folio)); folio_putback_lru(folio); } } @@ -2272,9 +2272,8 @@ static int __add_folio_for_migration(struct folio *fo= lio, int node, return 1; } else if (folio_isolate_lru(folio)) { list_add_tail(&folio->lru, pagelist); - node_stat_mod_folio(folio, - NR_ISOLATED_ANON + folio_is_file_lru(folio), - folio_nr_pages(folio)); + node_stat_add_folio(folio, + NR_ISOLATED_ANON + folio_is_file_lru(folio)); return 1; } return -EBUSY; @@ -2726,8 +2725,7 @@ int migrate_misplaced_folio_prepare(struct folio *fol= io, if (!folio_isolate_lru(folio)) return -EAGAIN; =20 - node_stat_mod_folio(folio, NR_ISOLATED_ANON + folio_is_file_lru(folio), - nr_pages); + node_stat_add_folio(folio, NR_ISOLATED_ANON + folio_is_file_lru(folio)); return 0; } =20 diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 833f743f309f..87e9ea41313a 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2750,7 +2750,7 @@ bool folio_redirty_for_writepage(struct writeback_con= trol *wbc, =20 wb =3D unlocked_inode_to_wb_begin(inode, &cookie); current->nr_dirtied -=3D nr; - node_stat_mod_folio(folio, NR_DIRTIED, -nr); + node_stat_sub_folio(folio, NR_DIRTIED); wb_stat_mod(wb, WB_DIRTIED, -nr); unlocked_inode_to_wb_end(inode, &cookie); } @@ -2981,7 +2981,7 @@ bool __folio_end_writeback(struct folio *folio) =20 lruvec_stat_mod_folio(folio, NR_WRITEBACK, -nr); zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); - node_stat_mod_folio(folio, NR_WRITTEN, nr); + node_stat_add_folio(folio, NR_WRITTEN); =20 return ret; } diff --git a/mm/swap_state.c b/mm/swap_state.c index 1415a5c54a43..d08e923c9979 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -160,7 +160,7 @@ void __swap_cache_add_folio(struct swap_cluster_info *c= i, folio_set_swapcache(folio); folio->swap =3D entry; =20 - node_stat_mod_folio(folio, NR_FILE_PAGES, nr_pages); + node_stat_add_folio(folio, NR_FILE_PAGES); lruvec_stat_mod_folio(folio, NR_SWAPCACHE, nr_pages); } =20 @@ -265,7 +265,7 @@ void __swap_cache_del_folio(struct swap_cluster_info *c= i, struct folio *folio, =20 folio->swap.val =3D 0; folio_clear_swapcache(folio); - node_stat_mod_folio(folio, NR_FILE_PAGES, -nr_pages); + node_stat_sub_folio(folio, NR_FILE_PAGES); lruvec_stat_mod_folio(folio, NR_SWAPCACHE, -nr_pages); =20 if (!folio_swapped) { --=20 2.43.0 From nobody Mon Jun 15 22:00:12 2026 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6B153C0601 for ; Tue, 14 Apr 2026 09:16:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158181; cv=none; b=JISc4t68xIhjc7/1GdI2L2mO65IHflaz2Jw/fCBcpa4D40pqTyuOImyoJFwP4ssb1xawDderj9nr6rZiB1OtUyoODSzwV+vR4Msuem2gALBf08S3vMLipM5WAWK3kLcqMqcX67aYYXuxJyNbAeHqw+3Meelh7CvmErJ0ZSFpkMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158181; c=relaxed/simple; bh=nxTxVq6K3Bw2U0JDrr9AvYOfbWqH/rjUKDpf5OEqgXw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AkixfoBy2wkM5EltY+BjaiF6+lbAXli9hpUT2/2BjdNA+PX1MY+eB+EYW6ssDUJVdaXmLfjWe3gW5tUbu3VI/yUxDZa3YDjgivygd/4EusA4li/qdLj3LSpx6eo/rfLOnZOuKB1zVm0YPruugZ3okCPi2n5nMBorFGPNw+LZAKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=TX2kBkfH; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="TX2kBkfH" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776158177; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9Im9++lg/lpHN74Nk2FRmzX3snVH1LvwzoX73u95S3I=; b=TX2kBkfHAXl/AoJvsdawQlVCbbtFUOqmbqWwxcLAtHnvy8fCkD5glCD6qJF9rHwnYhySDH kjm51JNBzG2pEhhpUtjzdZZUioipbKBvZxZMy/tuFt3LOcA/Ykb9namQ677T6BvWiQ6goN 2w1Wvh0FSYcZSJt1i/keRIly3WOEgbE= From: Ye Liu To: Andrew Morton , "Liam R. Howlett" , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" , Vlastimil Babka Cc: Ye Liu , Jann Horn , Pedro Falcato , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/4] mm/vmstat: use zone_stat_add_folio/sub_folio for folio_nr_pages operations Date: Tue, 14 Apr 2026 17:15:19 +0800 Message-ID: <20260414091527.2970844-3-ye.liu@linux.dev> In-Reply-To: <20260414091527.2970844-1-ye.liu@linux.dev> References: <20260414091527.2970844-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu Replace zone_stat_mod_folio() calls that pass folio_nr_pages(folio) or -folio_nr_pages(folio) as the third argument with the more concise zone_stat_add_folio() and zone_stat_sub_folio() functions respectively. This makes the code more readable and reduces the number of arguments passed to these functions. Signed-off-by: Ye Liu --- mm/mlock.c | 4 ++-- mm/page-writeback.c | 8 ++++---- mm/page_alloc.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index 8c227fefa2df..0cafcb2f4e8d 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -249,7 +249,7 @@ void mlock_folio(struct folio *folio) if (!folio_test_set_mlocked(folio)) { int nr_pages =3D folio_nr_pages(folio); =20 - zone_stat_mod_folio(folio, NR_MLOCK, nr_pages); + zone_stat_add_folio(folio, NR_MLOCK); __count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); } =20 @@ -273,7 +273,7 @@ void mlock_new_folio(struct folio *folio) fbatch =3D this_cpu_ptr(&mlock_fbatch.fbatch); folio_set_mlocked(folio); =20 - zone_stat_mod_folio(folio, NR_MLOCK, nr_pages); + zone_stat_add_folio(folio, NR_MLOCK); __count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); =20 folio_get(folio); diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 87e9ea41313a..6f9b7b081ab7 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2647,7 +2647,7 @@ void folio_account_cleaned(struct folio *folio, struc= t bdi_writeback *wb) long nr =3D folio_nr_pages(folio); =20 lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, -nr); - zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); + zone_stat_sub_folio(folio, NR_ZONE_WRITE_PENDING); wb_stat_mod(wb, WB_RECLAIMABLE, -nr); task_io_account_cancelled_write(nr * PAGE_SIZE); } @@ -2916,7 +2916,7 @@ bool folio_clear_dirty_for_io(struct folio *folio) if (folio_test_clear_dirty(folio)) { long nr =3D folio_nr_pages(folio); lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, -nr); - zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); + zone_stat_sub_folio(folio, NR_ZONE_WRITE_PENDING); wb_stat_mod(wb, WB_RECLAIMABLE, -nr); ret =3D true; } @@ -2980,7 +2980,7 @@ bool __folio_end_writeback(struct folio *folio) } =20 lruvec_stat_mod_folio(folio, NR_WRITEBACK, -nr); - zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); + zone_stat_sub_folio(folio, NR_ZONE_WRITE_PENDING); node_stat_add_folio(folio, NR_WRITTEN); =20 return ret; @@ -3032,7 +3032,7 @@ void __folio_start_writeback(struct folio *folio, boo= l keep_write) } =20 lruvec_stat_mod_folio(folio, NR_WRITEBACK, nr); - zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); + zone_stat_add_folio(folio, NR_ZONE_WRITE_PENDING); =20 access_ret =3D arch_make_folio_accessible(folio); /* diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 65e205111553..a81ceb4181ea 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1327,7 +1327,7 @@ __always_inline bool __free_pages_prepare(struct page= *page, long nr_pages =3D folio_nr_pages(folio); =20 __folio_clear_mlocked(folio); - zone_stat_mod_folio(folio, NR_MLOCK, -nr_pages); + zone_stat_sub_folio(folio, NR_MLOCK); count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages); } =20 --=20 2.43.0 From nobody Mon Jun 15 22:00:12 2026 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 561CC39E194 for ; Tue, 14 Apr 2026 09:16:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158187; cv=none; b=AF5MQwJM1X4XABiiaa9ZOZNvWbjx57Jt8cOQsfimNsz0Ln+KHqAXLwsXc8iXNyS5Smyi/5B9QOqr7OGD+gDRMu3XARr4MH9DDJUUHVHG12EQ/WQrNFr3Q8iWuV7IKWc8s7fu2Dj4p+ZJiiBIO/m7o71uAth7B6OMAdo2NRlMROI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158187; c=relaxed/simple; bh=nabJJ2tRSjgXsfVhjycDB6bNUKrgkKWj5cInp5QbIus=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YrNUvF813eYsciSQDSSOfh+n2+wL07YUfU3pcQDw9w1cJA5UGIE1s9q6jPKge0doqIyKoePvqVt8UxdAu3Tlw6YqNjq9zkvmlmM88pELj/iu+HeEpVhpiTYDc0tXjzCPYEQxGKu7HJm7dYBXBKqi9WNUPFXJZZm/I8b++uFZzpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=buF2bIC9; arc=none smtp.client-ip=95.215.58.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="buF2bIC9" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776158184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cl11sG7u/+NHktUdM96cUoh+7Wg6iuNjhJ6suVzR84k=; b=buF2bIC9KmRd4kn31/Rusxq2pS4W/UeA2oA4o3ZAcUXos0LYlUrzpsYxwtDnmudQT50ba5 59iTe9p7v/FvolvAKJV66cbFhFktzN3bnXnbLv+bl1tgWVVyyd/HUkkn20vie8g7RIKo04 xFd4cDpi6wgUFlos4LqRyj+2SluPsLU= From: Ye Liu To: Andrew Morton , David Hildenbrand , "Matthew Wilcox (Oracle)" Cc: Ye Liu , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/4] mm/vmstat: remove unused __node_stat_* wrappers Date: Tue, 14 Apr 2026 17:15:20 +0800 Message-ID: <20260414091527.2970844-4-ye.liu@linux.dev> In-Reply-To: <20260414091527.2970844-1-ye.liu@linux.dev> References: <20260414091527.2970844-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu Replace the single call to __node_stat_mod_folio() with node_stat_mod_folio(), and remove the dead inline __node_stat_* wrapper definitions from include/linux/vmstat.h. Signed-off-by: Ye Liu --- include/linux/vmstat.h | 18 ------------------ mm/page-writeback.c | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 3c9c266cf782..54da7d820f78 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -440,24 +440,6 @@ static inline void zone_stat_sub_folio(struct folio *f= olio, mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio)); } =20 -static inline void __node_stat_mod_folio(struct folio *folio, - enum node_stat_item item, long nr) -{ - __mod_node_page_state(folio_pgdat(folio), item, nr); -} - -static inline void __node_stat_add_folio(struct folio *folio, - enum node_stat_item item) -{ - __mod_node_page_state(folio_pgdat(folio), item, folio_nr_pages(folio)); -} - -static inline void __node_stat_sub_folio(struct folio *folio, - enum node_stat_item item) -{ - __mod_node_page_state(folio_pgdat(folio), item, -folio_nr_pages(folio)); -} - static inline void node_stat_mod_folio(struct folio *folio, enum node_stat_item item, long nr) { diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 6f9b7b081ab7..ed3301753e89 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2627,7 +2627,7 @@ static void folio_account_dirtied(struct folio *folio, =20 lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, nr); __zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); - __node_stat_mod_folio(folio, NR_DIRTIED, nr); + node_stat_mod_folio(folio, NR_DIRTIED, nr); wb_stat_mod(wb, WB_RECLAIMABLE, nr); wb_stat_mod(wb, WB_DIRTIED, nr); task_io_account_write(nr * PAGE_SIZE); --=20 2.43.0 From nobody Mon Jun 15 22:00:12 2026 Received: from out-188.mta1.migadu.com (out-188.mta1.migadu.com [95.215.58.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 300A63BE17F for ; Tue, 14 Apr 2026 09:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158192; cv=none; b=OWSCLP0jwqOzZGZUrYwT4XEG7RD440GKxHL1VbzuTNJnXoYrEAwUvkGzEg4v9U6GxlR0bK79BAQELhN5TwAC03xZWMRCmcuK1JKjGG4NQNhGrCNUtUqQsEBRVCk+wzhZkympkRZd8rXZkahIRqfNzsD7lO/O8HHFoLdntiuYYFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776158192; c=relaxed/simple; bh=X9tUl1YJczEifAlFTO7a72YOYzVQxoefF/ZtAImlv+s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s02brDkT6MIB/ljozGKYYWlskO9SKw9746BlrgoF217GMBx/FLXMHUsE1TeqmBmCLD40Qc3Ej1ZU+4sLLvfHte5FNmS2CwN3LIDEPQ2krjIluAPPD3fy471Br0J7Nb99aCsWadCbKvnHt09BEWKWqQmC3CkZR+0FprvdJASn5xA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=bSzUWx5M; arc=none smtp.client-ip=95.215.58.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="bSzUWx5M" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1776158189; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EUwHi+Ort/Ib9sz8toDLY7SUId44AzcYXWL5RjCYhJU=; b=bSzUWx5MKFC5mvcnmpsT84AJ0+or8OtzZQhWDdciCAm54q0oDl5GeX3RJt4OyFGfgCc24o 2iASg8NQc6TZdX2Cv3v71/uzQMPOcxhw+UX82Q1AvjbKDb4M0bDETBoRQ52+iXhQspfRpI Xu11Is5OQ36tweOrFYfGq0vi1dUcZ3o= From: Ye Liu To: Andrew Morton , David Hildenbrand , "Liam R. Howlett" , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" Cc: Ye Liu , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jann Horn , Pedro Falcato , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/4] mm/vmstat: remove unused __zone_stat_* wrappers Date: Tue, 14 Apr 2026 17:15:21 +0800 Message-ID: <20260414091527.2970844-5-ye.liu@linux.dev> In-Reply-To: <20260414091527.2970844-1-ye.liu@linux.dev> References: <20260414091527.2970844-1-ye.liu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Ye Liu Replace the remaining __zone_stat_mod_folio() call with zone_stat_mod_folio(), and remove the dead inline __zone_stat_* wrappers definitions from include/linux/vmstat.h. Signed-off-by: Ye Liu --- include/linux/vmstat.h | 18 ------------------ mm/mlock.c | 2 +- mm/page-writeback.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 54da7d820f78..009b80e3c048 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -404,24 +404,6 @@ static inline void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *pzstats) { } #endif /* CONFIG_SMP */ =20 -static inline void __zone_stat_mod_folio(struct folio *folio, - enum zone_stat_item item, long nr) -{ - __mod_zone_page_state(folio_zone(folio), item, nr); -} - -static inline void __zone_stat_add_folio(struct folio *folio, - enum zone_stat_item item) -{ - __mod_zone_page_state(folio_zone(folio), item, folio_nr_pages(folio)); -} - -static inline void __zone_stat_sub_folio(struct folio *folio, - enum zone_stat_item item) -{ - __mod_zone_page_state(folio_zone(folio), item, -folio_nr_pages(folio)); -} - static inline void zone_stat_mod_folio(struct folio *folio, enum zone_stat_item item, long nr) { diff --git a/mm/mlock.c b/mm/mlock.c index 0cafcb2f4e8d..654487063fbb 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -141,7 +141,7 @@ static struct lruvec *__munlock_folio(struct folio *fol= io, struct lruvec *lruvec =20 munlock: if (folio_test_clear_mlocked(folio)) { - __zone_stat_mod_folio(folio, NR_MLOCK, -nr_pages); + zone_stat_mod_folio(folio, NR_MLOCK, -nr_pages); if (isolated || !folio_test_unevictable(folio)) __count_vm_events(UNEVICTABLE_PGMUNLOCKED, nr_pages); else diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ed3301753e89..dc15d775761e 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2626,7 +2626,7 @@ static void folio_account_dirtied(struct folio *folio, wb =3D inode_to_wb(inode); =20 lruvec_stat_mod_folio(folio, NR_FILE_DIRTY, nr); - __zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); + zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); node_stat_mod_folio(folio, NR_DIRTIED, nr); wb_stat_mod(wb, WB_RECLAIMABLE, nr); wb_stat_mod(wb, WB_DIRTIED, nr); --=20 2.43.0