Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5224004pxv; Tue, 20 Jul 2021 23:45:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0dB5VQljP3K/lgpcHGz585lwMBmFrempuhrcDzHecS1zcG3yaPLjc3AvZmsuN+hkyuHIL X-Received: by 2002:a05:6402:1bc6:: with SMTP id ch6mr47041576edb.267.1626849913598; Tue, 20 Jul 2021 23:45:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626849913; cv=none; d=google.com; s=arc-20160816; b=ILjSYZqn6IoiZEiT5p42ZqPTHiTQSAtMjK5zFsfZNR4wb+8kUoi9+Pv+NxRvG4NUU5 OI9m2pPvQo+IYHciH9f5v/cEAcWmmpK0eUJdnRbTxu2CzDOVTR+RmnP1I1p/wcWLTIJr tvq2DKju2zLXAQjtACFj8SRmz+2P9cC9VyZ0MD6bzqKnFoGSxctkNs6DPeYvy1wgfJg2 EZtaqQoQ9UgnAa8+ylIpUayOVZtGD1zxxIgy96hugK7UGAXxTb44L703fdesBw5fgF+Z fE9+iukG8O2VAVrCEPZI3kYjSZ3kOfzr1Y8HPgbYLHWX3qJkY2ldMbmAtS5/mUlhqP8P UBoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6JeNvhuwWz156/BUJRRtwsQ1S+4eRq85Smd9DgK5Dts=; b=BRdvamhU8Ow0R/y1jKMSa5+7u2cTAkNJzrBbdZLTrwIAH/9nvZEu2wvctncMlBeEc+ PinCC6r6/SSJfZCtFGdcSS+LvuTwcYytRnK5b0wSjXy+O9U52WCi12bxM+kH912rSqHh 7gevN9BlB+Q+VK5J0ryr4xwAvk+V5toW6M2CjjwOlxK3hF/LncoHuUNTdFIGNp5bc1Z/ uKKwsJfEkbc4xoJm7BbhQW/soXxjvlelydri0fL/q5+dLSAxqcyLuGy97+VgL5EKe8dC iJZMx8DsAGGB0fLoClQXNeyqagh0V/uxc2PY2WokxL37sfq4bcADKKzvfie+EJSJcMLV P3aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f21si4994924edv.421.2021.07.20.23.44.50; Tue, 20 Jul 2021 23:45:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234221AbhGUGCC (ORCPT + 99 others); Wed, 21 Jul 2021 02:02:02 -0400 Received: from mga06.intel.com ([134.134.136.31]:44388 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234241AbhGUF7N (ORCPT ); Wed, 21 Jul 2021 01:59:13 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10051"; a="272496386" X-IronPort-AV: E=Sophos;i="5.84,257,1620716400"; d="scan'208";a="272496386" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 23:39:50 -0700 X-IronPort-AV: E=Sophos;i="5.84,257,1620716400"; d="scan'208";a="511390018" Received: from yhuang6-desk2.sh.intel.com ([10.239.159.119]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2021 23:39:46 -0700 From: Huang Ying To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , Dave Hansen , "Huang, Ying" , Yang Shi , Wei Xu , Michal Hocko , Zi Yan , David Rientjes , Dan Williams , David Hildenbrand , Oscar Salvador , Greg Thelen , Keith Busch Subject: [PATCH -V11 5/9] mm/vmscan: add page demotion counter Date: Wed, 21 Jul 2021 14:39:22 +0800 Message-Id: <20210721063926.3024591-5-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210721063926.3024591-1-ying.huang@intel.com> References: <20210721063926.3024591-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yang Shi Account the number of demoted pages. 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() ] Link: https://lkml.kernel.org/r/20210715055145.195411-6-ying.huang@intel.com Signed-off-by: Yang Shi Signed-off-by: Dave Hansen Signed-off-by: "Huang, Ying" Reviewed-by: Yang Shi Reviewed-by: Wei Xu Cc: Michal Hocko Cc: Zi Yan Cc: David Rientjes Cc: Dan Williams Cc: David Hildenbrand Cc: Oscar Salvador Cc: Greg Thelen Cc: Keith Busch Signed-off-by: Andrew Morton --- include/linux/vm_event_item.h | 2 ++ mm/vmscan.c | 5 +++++ mm/vmstat.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index ae0dd1948c2b..a185cc75ff52 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -33,6 +33,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, PGREUSE, PGSTEAL_KSWAPD, PGSTEAL_DIRECT, + PGDEMOTE_KSWAPD, + PGDEMOTE_DIRECT, PGSCAN_KSWAPD, PGSCAN_DIRECT, PGSCAN_DIRECT_THROTTLE, diff --git a/mm/vmscan.c b/mm/vmscan.c index 49d03b5e3c18..90fa026cfa29 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1322,6 +1322,11 @@ static unsigned int demote_page_list(struct list_head *demote_pages, 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 --git a/mm/vmstat.c b/mm/vmstat.c index 6246bab9fae2..13ff25d0d96a 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1217,6 +1217,8 @@ const char * const vmstat_text[] = { "pgreuse", "pgsteal_kswapd", "pgsteal_direct", + "pgdemote_kswapd", + "pgdemote_direct", "pgscan_kswapd", "pgscan_direct", "pgscan_direct_throttle", -- 2.30.2