Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5451137yba; Wed, 10 Apr 2019 20:59:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCtJS76cNi9Hq8GfvMHApkVdJzUoXZODgprSgJaRn3vIAM/KQNRxNicQAoBwamcdT3oXT2 X-Received: by 2002:a63:c746:: with SMTP id v6mr43917732pgg.401.1554955176428; Wed, 10 Apr 2019 20:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554955176; cv=none; d=google.com; s=arc-20160816; b=krmayR5Kk65Zymay+0WbTZDi9B8tGApfIdcXl3lm7bU0xGcAs26i0hDHL4MMJ9Q2Z9 g1lH2FQPWzqZbZaKDt73F52vEGoBNjjJJTb5GwCJFUacb34oSRy5DoC0Kcs+tYy21n3O NEhhmfMZzRfUqglw9Z0pbsZGvsFdbM62Nr2CUJjZcADnQN7184FS4JswSB83UXHU7gIM TwcZgMIWVdvVv32WLcDk2LeCTSQ6Cg7ufExSZAYwfNouMYzyB+mxFVyRM88swrc8BSPR Rg0z0trFVH42QU3dFofsIIH4zy0G5l0qKhdipuJGyoijqQF2XsoRBu1C+k0psl6Yrpa3 Tdhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=VBnAD41t69RqBOb9zPduWfXXPAif/Mt2uvTkTO6jcCY=; b=AsSENKHg8c5DBH3JMMnHMyPfM25SGbn2ETrEp6lQeF4R8QflBZldHbDzFSzAUSRJZt h7gBiAY201tp9DcvzvK/sfJzEbUeyoowFSdcFEgydEn+Q5CscgCUCyZDTOL2tT8Rf9AY xdikNEFxcUyk2i8PVnCqD49zOmDR50rQUbfouHMfOJJcRYnCh8bpNCjunvBMIqmOPzIp +l7rrIFrovbYixIttOg5mQ/eKthWiE+RvlI3RB5lsIgnSX9/Wa/eyALbyHr+EC2X+yGE /zD7K02JHt86VCV6aj92D/8wTnhy+rk7K8eunDbpkgaklC6S4c21h9AE93jF46uiNAgv TW+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si34162427pfc.276.2019.04.10.20.59.20; Wed, 10 Apr 2019 20:59:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbfDKD6L (ORCPT + 99 others); Wed, 10 Apr 2019 23:58:11 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:55887 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726801AbfDKD6L (ORCPT ); Wed, 10 Apr 2019 23:58:11 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R501e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0TP0I5rB_1554955031; Received: from e19h19392.et15sqa.tbsite.net(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TP0I5rB_1554955031) by smtp.aliyun-inc.com(127.0.0.1); Thu, 11 Apr 2019 11:57:24 +0800 From: Yang Shi To: mhocko@suse.com, mgorman@techsingularity.net, riel@surriel.com, hannes@cmpxchg.org, akpm@linux-foundation.org, dave.hansen@intel.com, keith.busch@intel.com, dan.j.williams@intel.com, fengguang.wu@intel.com, fan.du@intel.com, ying.huang@intel.com, ziy@nvidia.com Cc: yang.shi@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [v2 PATCH 9/9] mm: numa: add page promotion counter Date: Thu, 11 Apr 2019 11:56:59 +0800 Message-Id: <1554955019-29472-10-git-send-email-yang.shi@linux.alibaba.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1554955019-29472-1-git-send-email-yang.shi@linux.alibaba.com> References: <1554955019-29472-1-git-send-email-yang.shi@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add counter for page promotion for NUMA balancing. Signed-off-by: Yang Shi --- include/linux/vm_event_item.h | 1 + mm/huge_memory.c | 4 ++++ mm/memory.c | 4 ++++ mm/vmstat.c | 1 + 4 files changed, 10 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index 499a3aa..9f52a62 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -51,6 +51,7 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, NUMA_HINT_FAULTS, NUMA_HINT_FAULTS_LOCAL, NUMA_PAGE_MIGRATE, + NUMA_PAGE_PROMOTE, #endif #ifdef CONFIG_MIGRATION PGMIGRATE_SUCCESS, PGMIGRATE_FAIL, diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 0b18ac45..ca9d688 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1609,6 +1609,10 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd) migrated = migrate_misplaced_transhuge_page(vma->vm_mm, vma, vmf->pmd, pmd, vmf->address, page, target_nid); if (migrated) { + if (!node_state(page_nid, N_CPU_MEM) && + node_state(target_nid, N_CPU_MEM)) + count_vm_numa_events(NUMA_PAGE_PROMOTE, HPAGE_PMD_NR); + flags |= TNF_MIGRATED; page_nid = target_nid; } else diff --git a/mm/memory.c b/mm/memory.c index 01c1ead..7b1218b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3704,6 +3704,10 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) /* Migrate to the requested node */ migrated = migrate_misplaced_page(page, vma, target_nid); if (migrated) { + if (!node_state(page_nid, N_CPU_MEM) && + node_state(target_nid, N_CPU_MEM)) + count_vm_numa_event(NUMA_PAGE_PROMOTE); + page_nid = target_nid; flags |= TNF_MIGRATED; } else diff --git a/mm/vmstat.c b/mm/vmstat.c index d1e4993..fd194e3 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1220,6 +1220,7 @@ int fragmentation_index(struct zone *zone, unsigned int order) "numa_hint_faults", "numa_hint_faults_local", "numa_pages_migrated", + "numa_pages_promoted", #endif #ifdef CONFIG_MIGRATION "pgmigrate_success", -- 1.8.3.1