From patchwork Tue Jan 26 00:34:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 12045009 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 1D1C2C433E0 for ; Tue, 26 Jan 2021 00:41:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B7FB421D93 for ; Tue, 26 Jan 2021 00:41:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7FB421D93 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 CF4628D006B; Mon, 25 Jan 2021 19:41:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C80E08D0065; Mon, 25 Jan 2021 19:41:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9EE18D006B; Mon, 25 Jan 2021 19:41:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id A3FA08D0065 for ; Mon, 25 Jan 2021 19:41:51 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 70D37180AD838 for ; Tue, 26 Jan 2021 00:41:51 +0000 (UTC) X-FDA: 77746073622.22.toes49_041659f2758a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 5141D18038E67 for ; Tue, 26 Jan 2021 00:41:51 +0000 (UTC) X-HE-Tag: toes49_041659f2758a X-Filterd-Recvd-Size: 3908 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 00:41:50 +0000 (UTC) IronPort-SDR: 1irHkxnjtUc6m99LCFlp9R1N7aSOMnxGcmi7GXQhOYveXsftJylpmeNc4Z3z8sKCvEmiUq45yq F5uTw5m3+bJQ== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="177259364" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="177259364" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2021 16:41:49 -0800 IronPort-SDR: pQHygxC4qUnWqto+5NjrUq+YoSMkI/NVIU3ZhKR3nJ13hLODU6oenDR2jFFvRNRzK1wvpElQQg 4+SVD8xUt38Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208";a="577639920" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by fmsmga005.fm.intel.com with ESMTP; 25 Jan 2021 16:41:48 -0800 Subject: [RFC][PATCH 09/13] 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: Mon, 25 Jan 2021 16:34:29 -0800 References: <20210126003411.2AC51464@viggo.jf.intel.com> In-Reply-To: <20210126003411.2AC51464@viggo.jf.intel.com> Message-Id: <20210126003429.1045A904@viggo.jf.intel.com> 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 --- 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-01-25 16:23:15.821866693 -0800 +++ b/include/linux/vm_event_item.h 2021-01-25 16:23:15.831866693 -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-01-25 16:23:15.823866693 -0800 +++ b/mm/vmscan.c 2021-01-25 16:23:15.835866693 -0800 @@ -1120,6 +1120,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-01-25 16:23:15.825866693 -0800 +++ b/mm/vmstat.c 2021-01-25 16:23:15.838866693 -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",