Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10526368ybi; Thu, 11 Jul 2019 06:44:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuVUBTh8c3S6qwyIlOOWQ6sPyXhqsANJeT7+Gzndkg5gfsPxiLOkCwBbvmQIqe8gNMmsFt X-Received: by 2002:a17:902:f204:: with SMTP id gn4mr4847818plb.3.1562852693840; Thu, 11 Jul 2019 06:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562852693; cv=none; d=google.com; s=arc-20160816; b=miqnjmqtizOVT7rb7j7skBJrQYWwR9/j+rmr2+mwGyrib6MjPUJCq3kjrDE/Rj/a4G F6Cb5Oh/yymfLWeWzfLwFZf2VFrKd3XkEEcl0Y6CFZdQuKBuMFDZE/FNaJtYQdkBngj9 jx3wghfb2lm3Ks3V+KDd37bcuhnclTv8NH01cuC1qj79YfDa2p5lfxa5Naz9vUZ4c2/b N4Ms0GoBk9rKh/8k3YpQNDyOR7s13opGAoQMqtTQWTuG7SXT7Ub4QbIK3xHnl8E/kwr7 5TU5+hEvgWc+/pKQX4N3Wh1Bx4h/iUzbuA1uaH9AB/CQc05TSqcRVcbTDmqKTjrRO0OK 1hdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TBOYZ0TJRtXkPl4BWDGsbuy8MB5If3yCD5dZFWq2zO0=; b=Bnp20nZgwEhz0J+6hCRA2v+BBYzbRPqjzxmpd0Xdyxy723eLlsVfIKw4C4eUGZCoYb boieT75AhPDm8g2KuVdHki0sfRcdA59pGY9/HOqKXYcKFG/OSFFcufa6kqQbYH4m4dOP mwys/jmsTKE3cRvbHrCQNkKsJqYOCMMyUz2wxB9X0o+rFfjgtHmYxYhJkIr1419wyzst qdeVxITalc3dCZw/aVi0D5On++lDDG1VfaM4G56M9OGwQcoHk9+MVKTxPTFGuyBaYics EDjlVGF8CqHem5FlNeUp8tF0iijcPPURbVr8nDtQE2owvU6MqlXSvfGAR+sbKxqtlnyF 3omg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=0h1y0UG2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si5056340pgw.444.2019.07.11.06.44.38; Thu, 11 Jul 2019 06:44:53 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=0h1y0UG2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728268AbfGKNoN (ORCPT + 99 others); Thu, 11 Jul 2019 09:44:13 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55320 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbfGKNoN (ORCPT ); Thu, 11 Jul 2019 09:44:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TBOYZ0TJRtXkPl4BWDGsbuy8MB5If3yCD5dZFWq2zO0=; b=0h1y0UG2apY07KX9lcujJGVlJP 7BsFf1QI7kw9dZ9QFkRN3jZ6jGNVYCzTa9mcxtQ9ECqThLZHq8pvoqpJAwHtZwCw4GlnXAnvFxTde /s6Rv+1nVR1RHDbRwHgdRqXnLXLSJyjrWtkvM72Z5wjn8t10N+jIVsGNJqJfjpLOh+cMY0UPaFnpS Y0jg5QWZJcIPZ3DBM9zgnuKPMu9KtfYaQXk/pYEjsMfjdI/MPf2Zuev6ivKE1FS8IG27KMVgxpuh/ 69sHVDz+IxevRGT0k3TCldwKV3SdXxMD/60u4cPGqHLssnGQVDeCvbdNdd8Np/pb0LbrA7hcCPDk+ znssWpkg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hlZMZ-0003nD-9M; Thu, 11 Jul 2019 13:43:55 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A4BBC20B54EA6; Thu, 11 Jul 2019 15:43:53 +0200 (CEST) Date: Thu, 11 Jul 2019 15:43:53 +0200 From: Peter Zijlstra To: =?utf-8?B?546L6LSH?= 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 Subject: Re: [PATCH 1/4] numa: introduce per-cgroup numa balancing locality, statistic Message-ID: <20190711134353.GB3402@hirez.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3ac9b43a-cc80-01be-0079-df008a71ce4b@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); > + } > + > + rcu_read_lock(); > + memcg = mem_cgroup_from_task(p); > + if (idx != -1) > + this_cpu_inc(memcg->stat_numa->locality[idx]); > + rcu_read_unlock(); > +} > +#endif