From patchwork Fri Mar 5 00:00:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 12117163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EFF9C433E6 for ; Fri, 5 Mar 2021 00:01:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48E0564FFF for ; Fri, 5 Mar 2021 00:01:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48E0564FFF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DB7AF6B0010; Thu, 4 Mar 2021 19:01:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D41636B0012; Thu, 4 Mar 2021 19:01:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE36B6B0022; Thu, 4 Mar 2021 19:01:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id 9B39D6B0010 for ; Thu, 4 Mar 2021 19:01:04 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 639A01EF2 for ; Fri, 5 Mar 2021 00:01:04 +0000 (UTC) X-FDA: 77883865248.23.3D4AA66 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by imf28.hostedemail.com (Postfix) with ESMTP id 0539B2015DDF for ; Fri, 5 Mar 2021 00:01:03 +0000 (UTC) IronPort-SDR: ngLJDCqQiqH3jP0FjSktwEwxbW17/dgHxobf//Oe0YUSG7wVPq6xkS2sQMEUgjp80rDVqAlr5H 8CmPqJDfEaxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9913"; a="187639302" X-IronPort-AV: E=Sophos;i="5.81,223,1610438400"; d="scan'208";a="187639302" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2021 16:01:02 -0800 IronPort-SDR: u6tiM7EChXKnap2WU9nMY6+rO96oNcpw0iz5J5zR071El4CGIbdwlA9B6sNg7rODVYeXV3RJ+l pwvJrrL7vYMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,224,1610438400"; d="scan'208";a="436042233" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by FMSMGA003.fm.intel.com with ESMTP; 04 Mar 2021 16:00:52 -0800 Subject: [PATCH 06/10] mm/vmscan: add page demotion counter To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org,Dave Hansen ,yang.shi@linux.alibaba.com,rientjes@google.com,ying.huang@intel.com,dan.j.williams@intel.com,david@redhat.com,osalvador@suse.de From: Dave Hansen Date: Thu, 04 Mar 2021 16:00:00 -0800 References: <20210304235949.7922C1C3@viggo.jf.intel.com> In-Reply-To: <20210304235949.7922C1C3@viggo.jf.intel.com> Message-Id: <20210305000000.48BA4A97@viggo.jf.intel.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0539B2015DDF X-Stat-Signature: awyhjxxfh1npn1hc6xzjpidatr7ctou8 Received-SPF: none (linux.intel.com>: No applicable sender policy available) receiver=imf28; identity=mailfrom; envelope-from=""; helo=mga09.intel.com; client-ip=134.134.136.24 X-HE-DKIM-Result: none/none X-HE-Tag: 1614902463-730168 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: From: Yang Shi Account the number of demoted pages into reclaim_state->nr_demoted. Add pgdemote_kswapd and pgdemote_direct VM counters showed in /proc/vmstat. [ daveh: - __count_vm_events() a bit, and made them look at the THP size directly rather than getting data from migrate_pages() ] Signed-off-by: Yang Shi Signed-off-by: Dave Hansen Cc: David Rientjes Cc: Huang Ying Cc: Dan Williams Cc: David Hildenbrand Cc: osalvador Reviewed-by: Yang Shi --- Changes since 202010: * remove unused scan-control 'demoted' field --- b/include/linux/vm_event_item.h | 2 ++ b/mm/vmscan.c | 5 +++++ b/mm/vmstat.c | 2 ++ 3 files changed, 9 insertions(+) diff -puN include/linux/vm_event_item.h~mm-vmscan-add-page-demotion-counter include/linux/vm_event_item.h --- a/include/linux/vm_event_item.h~mm-vmscan-add-page-demotion-counter 2021-03-04 15:35:57.698806425 -0800 +++ b/include/linux/vm_event_item.h 2021-03-04 15:35:57.719806425 -0800 @@ -33,6 +33,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS PGREUSE, PGSTEAL_KSWAPD, PGSTEAL_DIRECT, + PGDEMOTE_KSWAPD, + PGDEMOTE_DIRECT, PGSCAN_KSWAPD, PGSCAN_DIRECT, PGSCAN_DIRECT_THROTTLE, diff -puN mm/vmscan.c~mm-vmscan-add-page-demotion-counter mm/vmscan.c --- a/mm/vmscan.c~mm-vmscan-add-page-demotion-counter 2021-03-04 15:35:57.700806425 -0800 +++ b/mm/vmscan.c 2021-03-04 15:35:57.724806425 -0800 @@ -1118,6 +1118,11 @@ static unsigned int demote_page_list(str target_nid, MIGRATE_ASYNC, MR_DEMOTION, &nr_succeeded); + if (current_is_kswapd()) + __count_vm_events(PGDEMOTE_KSWAPD, nr_succeeded); + else + __count_vm_events(PGDEMOTE_DIRECT, nr_succeeded); + return nr_succeeded; } diff -puN mm/vmstat.c~mm-vmscan-add-page-demotion-counter mm/vmstat.c --- a/mm/vmstat.c~mm-vmscan-add-page-demotion-counter 2021-03-04 15:35:57.708806425 -0800 +++ b/mm/vmstat.c 2021-03-04 15:35:57.726806425 -0800 @@ -1244,6 +1244,8 @@ const char * const vmstat_text[] = { "pgreuse", "pgsteal_kswapd", "pgsteal_direct", + "pgdemote_kswapd", + "pgdemote_direct", "pgscan_kswapd", "pgscan_direct", "pgscan_direct_throttle",