From patchwork Mon May 2 04:57:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 12833819 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 D625BC433F5 for ; Mon, 2 May 2022 04:57:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10AC06B0072; Mon, 2 May 2022 00:57:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 093076B0073; Mon, 2 May 2022 00:57:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E82AF6B0074; Mon, 2 May 2022 00:57:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id D254C6B0072 for ; Mon, 2 May 2022 00:57:54 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8F9EF2A588 for ; Mon, 2 May 2022 04:57:54 +0000 (UTC) X-FDA: 79419595668.20.D7715EA Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf06.hostedemail.com (Postfix) with ESMTP id 7DCFA180077 for ; Mon, 2 May 2022 04:57:52 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E8691210E1; Mon, 2 May 2022 04:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1651467472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VjyD08gDOYWy1q/rpusK4veIP/i1qsv19rrIqO0F3Hk=; b=M3vMTpud8eW0VE2Pb9OVoKUtuCEZn5Pnz49HmvxriDhkcSpbjykyFK4QW+hXwBXWRIolbz IZjKeERyf3ueLNWiGD5S5/xNaTBdVBzMEiB5D6D8znjEtC28TfRbq6+q49KtfA3DNh12Tz QqW6wbyJkvTJmXqG3D04Q2GXYrQiLVE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1651467472; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VjyD08gDOYWy1q/rpusK4veIP/i1qsv19rrIqO0F3Hk=; b=tKXvdWdITEUp4ffkEbhK+3ZplXSemTpcgCIjcPJVxpaHLuvcBOlm4NCy5ePfJ3NDr9Jgvd PLvTlLLjAyEGzWBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 38EB713491; Mon, 2 May 2022 04:57:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yT96Nc1kb2JZRAAAMHmgww (envelope-from ); Mon, 02 May 2022 04:57:49 +0000 MIME-Version: 1.0 From: "NeilBrown" To: "Miaohe Lin" Cc: "Andrew Morton" , "Geert Uytterhoeven" , "Christoph Hellwig" , linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] MM: handle THP in swap_*page_fs() - count_vm_events() Date: Mon, 02 May 2022 14:57:46 +1000 Message-id: <165146746627.24404.2324091720943354711@noble.neil.brown.name> X-Stat-Signature: eshmuxdsgqq7xepxy1hz6hwcbnmmaem3 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7DCFA180077 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=M3vMTpud; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=tKXvdWdI; spf=pass (imf06.hostedemail.com: domain of neilb@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=neilb@suse.de; dmarc=pass (policy=none) header.from=suse.de X-Rspam-User: X-HE-Tag: 1651467472-2010 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: We need to use count_swpout_vm_event() for sio_write_complete() and sio_read_complete(), to get correct counting. This patch should be squased into MM: handle THP in swap_*page_fs() Reported-by: Miaohe Lin Signed-off-by: NeilBrown --- mm/page_io.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index d636a3531cad..3e2e9029ce50 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -280,8 +280,10 @@ static void sio_write_complete(struct kiocb *iocb, long ret) set_page_dirty(page); ClearPageReclaim(page); } - } else - count_vm_events(PSWPOUT, sio->pages); + } else { + for (p = 0; p < sio->pages; p++) + count_swpout_vm_event(sio->bvec[p].bv_page); + } for (p = 0; p < sio->pages; p++) end_page_writeback(sio->bvec[p].bv_page); @@ -390,9 +392,9 @@ static void sio_read_complete(struct kiocb *iocb, long ret) struct page *page = sio->bvec[p].bv_page; SetPageUptodate(page); + count_swpout_vm_event(page); unlock_page(page); } - count_vm_events(PSWPIN, sio->pages); } else { for (p = 0; p < sio->pages; p++) { struct page *page = sio->bvec[p].bv_page;