Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3000779lqo; Tue, 21 May 2024 04:04:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxTmHq32C5VafeGcDd6EzvqSzM/VsnmRlM02JTVTfWaAcbLlcq0AfdTnh5PHNB7bGKsXVDn2l/N3WNdBNVs5bktI6vaiPhArczMpU3LA== X-Google-Smtp-Source: AGHT+IEIVd7KQzvQxrC6S0HPrx896Z75qNqM4AJ4yd+1FbWasEldRuh/gT8JKSK+MO9SjkPC97dC X-Received: by 2002:a05:6a00:1701:b0:6f4:b4a2:ab3b with SMTP id d2e1a72fcca58-6f4e0348597mr35807316b3a.24.1716289495520; Tue, 21 May 2024 04:04:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716289495; cv=pass; d=google.com; s=arc-20160816; b=g6JBrUra7lJTS/NJhEfNqZY/kJejnDNVt6g8HzQCaVCm4FiGc5VCu8ZDxT1Tzu+IN4 64AxRO+9U0CaOvGrjAstJNU8iIJMCwl9mEajM6odXLqaBRfZRwH1A3KuIYYubBXclkmD pSpAnkUg33cAlgF/VkaXt0Z+JZF4B+EfzmmOlY5NC/VTBYLPhIH4dWeM/uqk2qpZqEnD GfVOuXH9yeco8h2vnnerG+01KfGcg8KdM7sgThXLN2sVOGKAOrIAy4wk8ZrMFUkKyUjg Gtuf0nVngDbMdTQnGg2OyJnCBWb+zVcpINwwq9V14Sm5OHjcmnour+j01bGSLoJf1olT 6SWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jRAtHbKubpnpADzITDXZT1b01GiilShGna80PhKpWSg=; fh=yZfW+BHkES0D7lqXNSviUM/H3M0u/i+axAcBKiPVoLw=; b=dKhUKDrMMpq4rFthUYkCpuKTTAwHRAN84Sjx3wihUdlB9Pg+m+KxFG4naUi5E6i7De /aP0VIxsfsHLo6szULjC18H2hInFiu5WUpE7m4ORxyHpv7C2bEo2tufXGjpiE4wbcQoC U4fY1SLWQgCdyEzo6hQk9LZxw7SZMFBTy8U6p2h4YtKYt2kAdYo/teo99nTSV8apIjod Yfi7Mb1o7Gxh9oywKWtxAu6OdvAHxNSlUiHYo5Eur8Lictp4FrKauc909NUTM6gdaLAP AvlX74YWGBN8ohTAtYQQ5SM+gFmJFNI6nAEdCvVE5MDN19CSudHM8iwoOQyqey8jo4AW B6OA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=nzMjLmy3; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-184851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6340b3952a3si23344410a12.235.2024.05.21.04.04.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 04:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=nzMjLmy3; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-184851-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184851-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B80E6B226B8 for ; Tue, 21 May 2024 11:04:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A878576410; Tue, 21 May 2024 11:03:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="nzMjLmy3" Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (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 163D9745E7 for ; Tue, 21 May 2024 11:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716289423; cv=none; b=e1u/AlW6ZpnOE2n3AaDH5WMVZOJjBrKgQehiORt+b/bvCFVC3T6NzqQfU2TqW6cARZFGjaBrVSeWd1SNN2Po4msZOwD9W5UagQXxc4A+p6fkv7RRFa2U45vjOX3nmCihsHuITFuluuVQCpDwb/WJjmXye5yfybFUDdWy6JHDeKg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716289423; c=relaxed/simple; bh=rc2tOhLkwkX3ybDr66V8237pfMfld4Tlo9Wq9wRfzIk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tF7aMfd8EYYhmz4jF8xUzyRXGaJJ8Kx9CfAW0Ort78qQGPfZlM41zz7ve6EuAwMZmjcYzYryTas9khawoZa9ZwZZDr0nl0Qr2PxdOBVlZPI7U48gjyH2Pw8MybX8kLrVEjMpeKhBwAbfEopmB73jHdt6XcDtsHTsaWBR77MjHEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=nzMjLmy3; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1716289414; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=jRAtHbKubpnpADzITDXZT1b01GiilShGna80PhKpWSg=; b=nzMjLmy3ZA00agnVzDjG7nRemJ2J8K1qo4r4yJKo11Qfu19C9apclBzd40rzTaPT2yAezGz2vfwbDH0BOb+qpjpeDP6f0oN0pcSJW615OhhuvP1NauobnslPGlGjbJt57/NMlghbBRlRWT6kPh5tCBlcQMFwqeEZzx8/U4WrYDk= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W6xeTAt_1716289410; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W6xeTAt_1716289410) by smtp.aliyun-inc.com; Tue, 21 May 2024 19:03:31 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, ioworker0@gmail.com, hrisl@kernel.org, p.raghav@samsung.com, da.gomez@samsung.com, wangkefeng.wang@huawei.com, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/8] mm: fix shmem swapout statistic Date: Tue, 21 May 2024 19:03:11 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As we know, shmem not only supports the sharing of anonymous pages, but also the RAM-based temporary filesystem. Therefore, shmem swapouts should not be marked as anonymous swapout statistics. Fix it by adding folio_test_anon(). Fixes: d0f048ac39f6 ("mm: add per-order mTHP anon_swpout and anon_swpout_fallback counters") Signed-off-by: Baolin Wang --- mm/page_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/page_io.c b/mm/page_io.c index 46c603dddf04..b181b81f39e3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -217,7 +217,9 @@ static inline void count_swpout_vm_event(struct folio *folio) count_memcg_folio_events(folio, THP_SWPOUT, 1); count_vm_event(THP_SWPOUT); } - count_mthp_stat(folio_order(folio), MTHP_STAT_ANON_SWPOUT); + + if (folio_test_anon(folio)) + count_mthp_stat(folio_order(folio), MTHP_STAT_ANON_SWPOUT); #endif count_vm_events(PSWPOUT, folio_nr_pages(folio)); } -- 2.39.3