Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1204710pxj; Fri, 18 Jun 2021 01:47:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjcwndwy/MnxegYWM3s+fe9p8kXniHWFavL9v6XstnFo2+AdYiLtC0oIKQS/drSZcckAWy X-Received: by 2002:a05:6638:90:: with SMTP id v16mr2293417jao.21.1624006022701; Fri, 18 Jun 2021 01:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624006022; cv=none; d=google.com; s=arc-20160816; b=SZrC43KvPqYtwoWp3PrOT+pmQB4DkBYWNGhXSZAuBiQ9gaR5dAofll23HlCVal3uHx M2QeboZIEIdAWmAXa/x+ZAFmkjFhQdYmmDAys2rzMqfGs9VxbR0bdJmHiGsMWhv62ZxA RI+uvn2VhKqSXlQJY80BowjhpW9fZgyXB8tfz9zoHEzVrOhsGfkEfqG8mZjN8UIoEHgU U3flY9FtIRCn2wSviYqqLXbvNzSsHspDXs9azkPhv1hYpbRRjV72z+iA4V0mJuwxmmkr XDUJ4hdLxMCbc2ShS7C7bdQ7/gJb9cbOwBXRaCaROGnuchlL8dQbC0BCNqV4k9MDFbco WreA== 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 :ironport-sdr:ironport-sdr; bh=AclMLjZn6nDhMr0GOiADWF3yQ0zbJ1oVwrB69cUP0MM=; b=DxEwOdu2xP65FpgwMMx41TquJECjqZdeA5WEOD5melxSydfamWTmO1K1ZSehSxWVCj Asxk5LrG7/HEr5kyrpNKhBrS2NJjl7nal98VVjNrtCji6fth+kThqhzL4SEBl3HyXSiO QCCJyuLB5BcR00KK7cs7qmearlmLagkXIFJSuxdeGFTeRMuyFK+GPqXPKMooWFBo7Yfk dQzksWt/JhXxefjthhIlyJssHgTlSQxf5ppzVmL4qrElszDVGU5ccU5iIqQ+QYlO27tL nzRVCQNxPwSFwVmn4tRttxuyOEAhMFuPqpLPHJFkNIycI28kyrMNpwY/TmzfcIg/bPdc gvYQ== 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 n6si1508031ili.152.2021.06.18.01.46.50; Fri, 18 Jun 2021 01:47:02 -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 S231781AbhFRGWw (ORCPT + 99 others); Fri, 18 Jun 2021 02:22:52 -0400 Received: from mga18.intel.com ([134.134.136.126]:4815 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbhFRGU4 (ORCPT ); Fri, 18 Jun 2021 02:20:56 -0400 IronPort-SDR: ZHwIsZBuW+7c8xUWOFWEYRUp57nPh/jvUyMlEhOtJlphz/lT2HiXG2BIKOctqehuFfvMcCF8xW +5t6ZBYGaubA== X-IronPort-AV: E=McAfee;i="6200,9189,10018"; a="193815257" X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="193815257" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 23:16:23 -0700 IronPort-SDR: IUjkEwm0XElNDp6FrclSjaclAFLl32enZKn+q4lFKRahTklE3wGaTOj+hfzFKzAcun2pHt+Kis 2USYtyIb90gQ== X-IronPort-AV: E=Sophos;i="5.83,283,1616482800"; d="scan'208";a="485573673" Received: from mzhou6-mobl1.ccr.corp.intel.com (HELO yhuang6-mobl1.ccr.corp.intel.com) ([10.254.212.155]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 23:16:20 -0700 From: Huang Ying To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Yang Shi , Dave Hansen , "Huang, Ying" , Yang Shi , Michal Hocko , Wei Xu , David Rientjes , Dan Williams , David Hildenbrand , osalvador Subject: [PATCH -V8 06/10] mm/vmscan: add page demotion counter Date: Fri, 18 Jun 2021 14:15:33 +0800 Message-Id: <20210618061537.434999-7-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210618061537.434999-1-ying.huang@intel.com> References: <20210618061537.434999-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() ] Signed-off-by: Yang Shi Signed-off-by: Dave Hansen Signed-off-by: "Huang, Ying" Reviewed-by: Yang Shi Cc: Michal Hocko Cc: Wei Xu Cc: David Rientjes Cc: Dan Williams Cc: David Hildenbrand Cc: osalvador -- Changes since 202010: * remove unused scan-control 'demoted' field --- 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 ddda32031f0c..7d5c7216a4b7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1317,6 +1317,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 cccee36b289c..a51fbdcadff5 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1259,6 +1259,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