Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3905584iob; Mon, 2 May 2022 08:24:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVEgYUC9LvWd5g8A9dbAGV6eb6WxX81Iu/5a7SCmg8sIYdLpjg8rbS0V3f8mZ0WsrqQWP2 X-Received: by 2002:a05:6512:2284:b0:472:60cf:da83 with SMTP id f4-20020a056512228400b0047260cfda83mr5304087lfu.660.1651505069544; Mon, 02 May 2022 08:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651505069; cv=none; d=google.com; s=arc-20160816; b=rGwpPSNvXozSqGoeYRwKy1OcCAzkPnncqv5gkFNzXBK5Yv2kylzVRttZ0/TGGFHVTf 6s/N318YbK0yEqeuwQjC9OC1Pomfc6H9+lJYQMvAmxZTK+RfJLRSP2XXi7+WePxNGSzB BMveFdf8ggHh6kxCmsoBqZsmhOX0Jvz2xv65mEo67WOvgjPxpUK62aGPAfrMcZhpfwmn AvJh3x6qjhQh3NTcT/dsdbLfi3lUW+tkZPNBtdMzFlmb5O96JCl80pTT8dzex3tq1rxZ RjFx2ZJIyyw+oxdE90gBJoQU4/1TQeO04ZlMlebwh3tvRCAg37aB6XCI1P5+BsoNuiId Gv3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:mime-version :content-transfer-encoding:dkim-signature:dkim-signature; bh=VjyD08gDOYWy1q/rpusK4veIP/i1qsv19rrIqO0F3Hk=; b=AEwnN4lFiDpvUfzxN9qYRZyiStkZvZCDiEe0FXoaJ8OaMQJcauX9GGB2TM3A22bBfC WS4Xln8Cz3bru4JfKb8EvwK1aUGn1xhD+PrFKDBTLntY4C7svD7gHJLnVnejW8qVcwYA ducqJtoP6xh8qbEnvYRUofCbQ9rsmLkgIDQZM2qDmwOgtdxXwmacFKiBfQ3ureCSyXXa MVSXQUrjywqXlL8EabmnOjTYiqYcO/uma1JzC/oaHppJiBc81jqmWiuqxfTVC1bM15mm R09bq88AxBiA1ATWaMagQ1qapY0ZpoNgzL3HKBF0M96SAcZ1GSLKxqI5/pS9b6Fct4ms KVQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=M3vMTpud; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u30-20020ac25bde000000b0047210af609bsi13118978lfn.27.2022.05.02.08.23.50; Mon, 02 May 2022 08:24:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=M3vMTpud; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383278AbiEBFBW (ORCPT + 99 others); Mon, 2 May 2022 01:01:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346303AbiEBFBV (ORCPT ); Mon, 2 May 2022 01:01:21 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F9F58E4E; Sun, 1 May 2022 21:57:54 -0700 (PDT) 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 =3D 0; p < sio->pages; p++) + count_swpout_vm_event(sio->bvec[p].bv_page); + } =20 for (p =3D 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 re= t) struct page *page =3D sio->bvec[p].bv_page; =20 SetPageUptodate(page); + count_swpout_vm_event(page); unlock_page(page); } - count_vm_events(PSWPIN, sio->pages); } else { for (p =3D 0; p < sio->pages; p++) { struct page *page =3D sio->bvec[p].bv_page; --=20 2.36.0