Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp329416ybi; Thu, 11 Jul 2019 20:17:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOyD7coryxJgdPmVaRqmxD5GV/ABD8i924nwIsLj3nuQykEQ7eKDryR2od1oZSrBQpv5ZG X-Received: by 2002:a17:902:26c:: with SMTP id 99mr8871819plc.215.1562901434771; Thu, 11 Jul 2019 20:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562901434; cv=none; d=google.com; s=arc-20160816; b=K7iSsHgn5aSCGhwwy/UwYABgyDGVQbHASfGcj1nJ/Zp9K3IUYX0qPAAsrFQys/YMk5 yTRu+7ehw7vRnsnTWxZ1a92VV+QAGkBZebWVVUNoi3mRpYpIgnW5ImrtssfXZPur9SFA ZQTKuei9k7zn0C7kDvbUY6caz99gNiqE9SLBj4HBQISQGh5dTtLpPLVAyJHXmvILKcN2 m7me3igqDCIyPJnva+ELONGCicVUgOAI8ytSHzo3yG2L06QgYVc5EuHYymdF6SsVgKzJ Z+z+p2TBjYoNZRLLNJ6Tq2P7KyGrbqBn4tAT1dGG/T7KFL9LWVoOCmY7jd+Cno2jxHZr E3OA== 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:from:references:cc:to:subject; bh=R93yLVnAsPXT8b8mxuxaUeLoFSeRIrrDZYtn6SthsCM=; b=vKLIpD1AEo5LD+qic0FW0JirF4johCy7An5oBNWK7yCHjKMo8MvQKBYL2+NNHQSQsg En1tyTroK0/05AN8BTosBJvCCC3HvS5ZFDW3yAKnqY4A5AkiylYBTR5RkqSAj1FP6NEJ 5Mjx/XO88D8+MZVqaajq7uGL22weSTGmU+60Z5+Az4e2bzFb0vD+p+0rtyzVs3rXF1hu vG+cVT0RKuXpcX8GavMRmj814mxpQT19+QlswSumKG67HMKnyZ/e6RDlw4SJzgHDwcMY LgS3022cIVLR0/iCUrtfUj7SLZuxESiADzpyW/qMrVcwsfISo3bYzaogsqXQsfQQEzRJ WmCA== 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 61si6372836ple.275.2019.07.11.20.16.59; Thu, 11 Jul 2019 20:17:14 -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 S1729311AbfGLDPr (ORCPT + 99 others); Thu, 11 Jul 2019 23:15:47 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:6691 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728497AbfGLDPr (ORCPT ); Thu, 11 Jul 2019 23:15:47 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07487;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0TWfarb8_1562901341; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0TWfarb8_1562901341) by smtp.aliyun-inc.com(127.0.0.1); Fri, 12 Jul 2019 11:15:42 +0800 Subject: Re: [PATCH 1/4] numa: introduce per-cgroup numa balancing locality, statistic To: Peter Zijlstra Cc: hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, Ingo Molnar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, mcgrof@kernel.org, keescook@chromium.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, Mel Gorman , riel@surriel.com References: <209d247e-c1b2-3235-2722-dd7c1f896483@linux.alibaba.com> <60b59306-5e36-e587-9145-e90657daec41@linux.alibaba.com> <3ac9b43a-cc80-01be-0079-df008a71ce4b@linux.alibaba.com> <20190711134353.GB3402@hirez.programming.kicks-ass.net> From: =?UTF-8?B?546L6LSH?= Message-ID: Date: Fri, 12 Jul 2019 11:15:41 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190711134353.GB3402@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/7/11 δΈ‹εˆ9:43, Peter Zijlstra wrote: > On Wed, Jul 03, 2019 at 11:28:10AM +0800, ηŽ‹θ΄‡ wrote: >> +#ifdef CONFIG_NUMA_BALANCING >> + >> +enum memcg_numa_locality_interval { >> + PERCENT_0_29, >> + PERCENT_30_39, >> + PERCENT_40_49, >> + PERCENT_50_59, >> + PERCENT_60_69, >> + PERCENT_70_79, >> + PERCENT_80_89, >> + PERCENT_90_100, >> + NR_NL_INTERVAL, >> +}; > > That's just daft; why not make 8 equal sized buckets. > >> +struct memcg_stat_numa { >> + u64 locality[NR_NL_INTERVAL]; >> +}; > >> + if (remote || local) { >> + idx = ((local * 10) / (remote + local)) - 2; > > idx = (NR_NL_INTERVAL * local) / (remote + local); Make sense, we actually want to observe the situation rather than the ratio itself, will be in next version. Regards, Michael Wang > >> + } >> + >> + rcu_read_lock(); >> + memcg = mem_cgroup_from_task(p); >> + if (idx != -1) >> + this_cpu_inc(memcg->stat_numa->locality[idx]); >> + rcu_read_unlock(); >> +} >> +#endif