Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp520193ybb; Thu, 28 Mar 2019 07:07:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwyWr5igO4lgbC0cDi9nLBD1bfhhsdzWDojEKw+FsDhShqZjerjfKxFTiR+6+T/P2TAgEn X-Received: by 2002:aa7:8096:: with SMTP id v22mr2297170pff.94.1553782028890; Thu, 28 Mar 2019 07:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553782028; cv=none; d=google.com; s=arc-20160816; b=xmJiskKCKwCbBKatFHz09Qez7FHUA1tElD6l4TuT0Tm8VkOxy3lAjpYIVYtIU9Aqf+ tntrlXY2wJIIWXRA4JPW8rQdYy8UOiNvV33O3Gmc6BWGGpRdKdc+IDHB1aR+euqGLlAs PfCTmD21hm1z8hEDphkzURHYNgkVDC3mFKhO5BTErp5xnIN21JJmzK3NG/G9rMbBWBAt DGEfC2yc/3xUi4GNSA4SdPt7zXoqcQ3U7ClHfLFsEmIKS0kic5le9S/5pVkT9z0qzkDE yQDN+EKEPpD6J4QzLntTzBLYrXkMFG2f3SA9h7q89iMsvCU0G7vdY6BjRtnGXMWXEU4M IR4g== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OZsN+KjF6P0mNOSjgzFw3fqkoVmkhJo6T0apoMNZd18=; b=efuky6F/9WlM2TvoGgrguY7JD0NPM5cPXbtHA1BytEwk4/I5mPcXcf+a4+meMIW7FT Lej5hfgOUqVbom0/yLKRKT4vWVX0V/5oC0tbVFH57lRieX5zMxUYm7smlzoV1JquwI8T SjeDjnovhHA4bk/+8yEdWnVQMB/h2hSroi1LIUfo253uJN4ZRkPbYaZX13LX8xCGln5H yTV6W9eGQxUQX9Y9Z/AsCQm8p51MSAgrZ6QlPJr8KtD9waFu43GIPLS1QuS88nkyOrQL d69xttnpwQ5Vrb5dBVM+zJEZWdlHLcsutCWW6X2FgE8eHs3TCTDOACyB+NqKa0OZZkpG MzJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=0Cj5ef94; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s79si20913159pgs.245.2019.03.28.07.06.51; Thu, 28 Mar 2019 07:07:08 -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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=0Cj5ef94; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726622AbfC1OFi (ORCPT + 99 others); Thu, 28 Mar 2019 10:05:38 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38049 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfC1OFi (ORCPT ); Thu, 28 Mar 2019 10:05:38 -0400 Received: by mail-qt1-f195.google.com with SMTP id d13so18485003qth.5 for ; Thu, 28 Mar 2019 07:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OZsN+KjF6P0mNOSjgzFw3fqkoVmkhJo6T0apoMNZd18=; b=0Cj5ef94+CRYvijQ1AKj4UAqc1sd4cV79FVilXIDCXG80htX0gpXBVJh72zcQtcJlO 83oIVfRWYgGi6lHslyDtBI3ISnwIp+M5c97aBdGGSBoOLO7P0Kq8VgRgXDXrDFSj6+Ly Fh1kQXuELevRdHZlCwh6RbGwkyggA16Rmaen1DQAvAgsDUxHHE4m5zGtKKuYRdDomMbS p/aamlRNU+LM7rc6ak7M6DGzDhKOv3Bos/DVp1U6uVikCyCEn5ZD5js8unIeQTNtJZZM TmQIYr/CClYewtDHXV+F6YqaE9UWtU8KTpv5bB3oZQlejMPBoKJYTh5o/oDASbqx/6V7 Gx+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OZsN+KjF6P0mNOSjgzFw3fqkoVmkhJo6T0apoMNZd18=; b=hqxdep5nPMG2Fa0WRdahXBigwLnMV/4VDBW9lMg6wQnleHjxMjA58mjVunsECG3rvr SXivONh9ACuiMIbxZpFZUy11nyar8dGZCLsXWhq2OQf4CYnGNOK6lRrJIRcQJ0LwXyAB ToAF44xlzh2VM7kGQJYA4y6WGgrL/pKnC00mmCoqBDUj+KK1xGguc2oG/DwaV4zq6zQa Pt2TXZXL69snviNafiUAOWUqNuBjKLKp1jIBg7SFuEguPX8Gg0TjmuoZue0MeU5SRt8C DQeKKXzOuO/X5Kycz5WLLs8mFLH0ibgkSRZUz4rAjcnKTuRYqtCgTch+igEZvCSv3yyQ t2Yw== X-Gm-Message-State: APjAAAV/X3sa1NKFKeR+9j0ekyNMvz/IsDECOe5Dn3DgESuvxamYDDvI DRSssLDYCznQMh9uOVR4bFNmBg== X-Received: by 2002:ac8:3fbc:: with SMTP id d57mr34297897qtk.96.1553781937336; Thu, 28 Mar 2019 07:05:37 -0700 (PDT) Received: from localhost (pool-108-27-252-85.nycmny.fios.verizon.net. [108.27.252.85]) by smtp.gmail.com with ESMTPSA id b37sm10221707qtb.92.2019.03.28.07.05.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Mar 2019 07:05:36 -0700 (PDT) Date: Thu, 28 Mar 2019 10:05:35 -0400 From: Johannes Weiner To: Greg Thelen Cc: Roman Gushchin , Andrew Morton , Michal Hocko , Vladimir Davydov , Tejun Heo , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] writeback: sum memcg dirty counters as needed Message-ID: <20190328140535.GA15622@cmpxchg.org> References: <20190307165632.35810-1-gthelen@google.com> <20190322181517.GA12378@tower.DHCP.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2019 at 03:29:47PM -0700, Greg Thelen wrote: > On Fri, Mar 22, 2019 at 11:15 AM Roman Gushchin wrote: > > On Thu, Mar 07, 2019 at 08:56:32AM -0800, Greg Thelen wrote: > > > + int cpu; > > > + > > > + for_each_online_cpu(cpu) > > > + x += per_cpu_ptr(memcg->stat_cpu, cpu)->count[idx]; > > > + if (x < 0) > > > + x = 0; > > > +#endif > > > + return x; > > > +} > > > > Also, isn't it worth it to generalize memcg_page_state() instead? > > By adding an bool exact argument? I believe dirty balance is not > > the only place, where we need a better accuracy. > > Nod. I'll provide a more general version of memcg_page_state(). I'm > testing updated (forthcoming v2) patch set now with feedback from > Andrew and Roman. I'm working on a patch series that reworks the memcg_page_state() API and by far the most callers do NOT need the exact numbers. So I'd ask to please keep this a separate function so I don't have to update tens of callsites to pass "false". Thanks!