lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53a3a4e5-6fb1-4a50-89f4-81ecc499dae6@linux.alibaba.com>
Date: Mon, 30 Jun 2025 15:05:39 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Kairui Song <kasong@...cent.com>, linux-mm@...ck.org
Cc: Andrew Morton <akpm@...ux-foundation.org>, Hugh Dickins
 <hughd@...gle.com>, Matthew Wilcox <willy@...radead.org>,
 Kemeng Shi <shikemeng@...weicloud.com>, Chris Li <chrisl@...nel.org>,
 Nhat Pham <nphamcs@...il.com>, Baoquan He <bhe@...hat.com>,
 Barry Song <baohua@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 6/7] mm/shmem, swap: fix major fault counting



On 2025/6/27 14:20, Kairui Song wrote:
> From: Kairui Song <kasong@...cent.com>
> 
> If the swapin failed, don't update the major fault count. There is a
> long existing comment for doing it this way, now with previous cleanups,
> we can finally fix it.

Sounds reasonable to me. Additionally, swapin failure is a rare event, 
so I think this patch will have little impact on user statistics.

Reviewed-by: Baolin Wang <baolin.wang@...ux.alibaba.com>

> Signed-off-by: Kairui Song <kasong@...cent.com>
> ---
>   mm/shmem.c | 11 +++++------
>   1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 5f2641fd1be7..ea9a105ded5d 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2316,12 +2316,6 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
>   	/* Look it up and read it in.. */
>   	folio = swap_cache_get_folio(swap, NULL, 0);
>   	if (!folio) {
> -		/* Or update major stats only when swapin succeeds?? */
> -		if (fault_type) {
> -			*fault_type |= VM_FAULT_MAJOR;
> -			count_vm_event(PGMAJFAULT);
> -			count_memcg_event_mm(fault_mm, PGMAJFAULT);
> -		}
>   		if (data_race(si->flags & SWP_SYNCHRONOUS_IO)) {
>   			/* Direct mTHP swapin without swap cache or readahead */
>   			folio = shmem_swapin_direct(inode, vma, index,
> @@ -2341,6 +2335,11 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
>   		}
>   		if (!folio)
>   			goto failed;
> +		if (fault_type) {
> +			*fault_type |= VM_FAULT_MAJOR;
> +			count_vm_event(PGMAJFAULT);
> +			count_memcg_event_mm(fault_mm, PGMAJFAULT);
> +		}
>   	}
>   	/*
>   	 * We need to split an existing large entry if swapin brought in a


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ