Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1933722yba; Sun, 21 Apr 2019 19:14:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyV8w/nueHZjV5ujYYkNojohsAnUBQe7o525gbp8dAx+7WOv2tJNKsnm0RKSMjKTe/BfzMA X-Received: by 2002:a63:5405:: with SMTP id i5mr16380485pgb.212.1555899243358; Sun, 21 Apr 2019 19:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555899243; cv=none; d=google.com; s=arc-20160816; b=srWvkIzRzEOYmHCBnCA5OEolpPjFFV9vzdY4CtfdMmSEPpEkKryTe2UD0IH+dj7VNX OGEDOTxDor6IFrKDuvlbmKfygdHNVFFktZB0Lv93ZzLcznpVol6Op9edvmdaRg25jmIN xTWqVcuwb5NI549vJv7cAcpMdj2fJHCISZovw/3XDtXpbm6jNFcWmpInOOVC5ZubZIyd LM0dCb9Tsv4xgakKk4SnR/JuJ5MwIdcmG1z65j5vVyj8x2ID4oEuwKGWgg1UCZrdUiMn ZfMTFS5prIirg1vHtKa5xaURapRsPccDZRhrEyLiDvPfjXD2X87Vn47Xkhaz1PQEmVpk sErw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject; bh=pY40CoSYGz8qeu59Gtp+cDe+haKFoPl7cbgES2o6vTk=; b=qmdQfEObiU7sNZvb0DPOGEz/921WLX5eMR3Eo8OsJpHCX9ZLYK/CD3bl3rxbv4wn7o m06/wPwrBz9d6+fpRu/YlV1F5sPQPdMBZoyJb7HYuO/iUCa83Zlw8MeGFWTqyLtO7B59 YNBej8pzQTUvFF4Q3sXVDrHUkdv6P7zmgjoSRtMQJsqLisnpYVseMsMpupiBn0SJOMac vKHdBq72UMkCTULcld8h3tmQ/x89p5jUWk3bwdTBitaSjFovnZANVM5ILp9v4I4CeZkI McvFn4Z4Ndf3elQ1ZiHbF1H1fT9lFBXLzk5+uFPALaMzWHeONlXYatmmmIU1R1Webcy6 m3gQ== 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 q1si5711475pgd.223.2019.04.21.19.13.48; Sun, 21 Apr 2019 19:14:03 -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 S1726344AbfDVCMY (ORCPT + 99 others); Sun, 21 Apr 2019 22:12:24 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:49089 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbfDVCMY (ORCPT ); Sun, 21 Apr 2019 22:12:24 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0TPtsv3i_1555899140; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0TPtsv3i_1555899140) by smtp.aliyun-inc.com(127.0.0.1); Mon, 22 Apr 2019 10:12:21 +0800 Subject: [RFC PATCH 2/5] numa: append per-node execution info in memory.numa_stat From: =?UTF-8?B?546L6LSH?= To: Peter Zijlstra , hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, Ingo Molnar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <209d247e-c1b2-3235-2722-dd7c1f896483@linux.alibaba.com> Message-ID: <7be82809-79d3-f6a1-dfe8-dd14d2b35219@linux.alibaba.com> Date: Mon, 22 Apr 2019 10:12:20 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <209d247e-c1b2-3235-2722-dd7c1f896483@linux.alibaba.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduced numa execution information, to imply the numa efficiency. By doing 'cat /sys/fs/cgroup/memory/CGROUP_PATH/memory.numa_stat', we see new output line heading with 'exectime', like: exectime 24399843 27865444 which means the tasks of this cgroup executed 24399843 ticks on node 0, and 27865444 ticks on node 1. Combined with the memory node info, we can estimate the numa efficiency, for example the memory.numa_stat show: total=4613257 N0=6849 N1=3928327 ... exectime 24399843 27865444 there could be unmovable or cache pages on N1, then good locality could mean nothing since we are not tracing these type of pages, thus bind the workloads on the cpus of N1 worth a try, in order to achieve the maximum performance bonus. Signed-off-by: Michael Wang --- include/linux/memcontrol.h | 1 + mm/memcontrol.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index bb62e6294484..e784d6252d5e 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -197,6 +197,7 @@ enum memcg_numa_locality_interval { struct memcg_stat_numa { u64 locality[NR_NL_INTERVAL]; + u64 exectime; }; #endif diff --git a/mm/memcontrol.c b/mm/memcontrol.c index b810d4e9c906..91bcd71fc38a 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3409,6 +3409,18 @@ static int memcg_numa_stat_show(struct seq_file *m, void *v) seq_printf(m, " %llu", sum); } seq_putc(m, '\n'); + + seq_puts(m, "exectime"); + for_each_online_node(nr) { + int cpu; + u64 sum = 0; + + for_each_cpu(cpu, cpumask_of_node(nr)) + sum += per_cpu(memcg->stat_numa->exectime, cpu); + + seq_printf(m, " %llu", sum); + } + seq_putc(m, '\n'); #endif return 0; @@ -3437,6 +3449,7 @@ void memcg_stat_numa_update(struct task_struct *p) memcg = mem_cgroup_from_task(p); if (idx != -1) this_cpu_inc(memcg->stat_numa->locality[idx]); + this_cpu_inc(memcg->stat_numa->exectime); rcu_read_unlock(); } #endif -- 2.14.4.44.g2045bb6