Received: by 10.213.65.68 with SMTP id h4csp170287imn; Thu, 15 Mar 2018 13:04:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELtmdaBtQEoStb8h6/TIRtqdQwnAJMgXtKmSK3n0M8LSaC4AERL+xRaBLhNXcPCUXB8AVLYp X-Received: by 10.98.189.24 with SMTP id a24mr8765475pff.125.1521144277424; Thu, 15 Mar 2018 13:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521144277; cv=none; d=google.com; s=arc-20160816; b=iSIP9RZZW7r/hcEwPtLrGQDSO+Zj8JGuerzYLib00nzubxJul9LqVqiAVe5P8OyGox pprhZszAehcd6fYQLuAIV8YcT6vCNJGo7TIdRaXbu0GwlWIPh7aa8E7IVAuoXuiIQO93 Ag/2JO16WXo1+YcrSQ1+J4ilKlA7JEN8MRF9kT/2EtJ+tTO/O6RI4DotRjlTXK6x9sGP Z7GGOLLdGDJQBg4Omq8A36Pzg+Z0kC+DN8L9MzOF3Y7ZKSD4aVw+7TVGEXGYfO0zLfFV SzSBwRv9p/bbGtjTAvkccNUewQhaJ5ZXxLwd5UaNUQbmGSwAYs3fo8izZ+sed+dz0ZY6 x4fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=g9aHvVfh2Hn2VmMQr0Z9PWKkY6CtZe63QVmCowY4kIY=; b=h875PYmLAgOJwxIuz6xfu/vo80yRnM99dP1tE4vPAOGAJldvPFfPDB48gdCtY9mi1g oH9PmL0AR3qjP4OXl0Oavg4pEJOkYh/0m0nX9kfkkbYgfi4S2AbM+ATCU8dE4ze2IKpG zL/bOBsFYbl36XrvH+R1furNO9/2O6JT3SopXxZUdMqKXCcPzlTwnKLvxe5zCtxieRrn 7emNmkMPSrQTVFpt7YfduoKxKrQE4bW67oS3uJuHPhlfB+cKp50qHeat28X236SBencA rSUFFOBi7cUfnbbLGJevd8dGdFsOLzVU62J2kH/vNbW97qv3rzVmyW7eM/s17+mfdrdE rPJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r3KOP7qK; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8-v6si4495893plk.464.2018.03.15.13.04.23; Thu, 15 Mar 2018 13:04:37 -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=@google.com header.s=20161025 header.b=r3KOP7qK; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752405AbeCOUBj (ORCPT + 99 others); Thu, 15 Mar 2018 16:01:39 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36013 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752337AbeCOUBh (ORCPT ); Thu, 15 Mar 2018 16:01:37 -0400 Received: by mail-pf0-f179.google.com with SMTP id 68so3250868pfx.3 for ; Thu, 15 Mar 2018 13:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=g9aHvVfh2Hn2VmMQr0Z9PWKkY6CtZe63QVmCowY4kIY=; b=r3KOP7qKlJglALfrUbypQlAMeHck9PLY9dsaWxiWMnsVdNBlAhkdONxpJiJSngwJfV bVTHy3vAjz6orpte1igQuq4rc7qqOa3cPpA2GsJKpCE7Sp/6T83oRNow9sgSd9KQt82u VCmGjdoYzBcA42dyQznYn5FswoBwfwn6X0TvKJSaEeQGTtw0yVJThP1XZKx2F5OhxW7J qxInysNOHdC+kKiX446MOlrntljOO4rJl470JX38S2j9tFeb7T9Rwus9/b2CoyY304YC qBBI9kCcqwxES8o0yOM7TRfZ2rhk0AxtJj/FxjWqkQ9mDS+6JeiVp39yjvzZvQkz56P6 6+dw== 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:in-reply-to:message-id :references:user-agent:mime-version; bh=g9aHvVfh2Hn2VmMQr0Z9PWKkY6CtZe63QVmCowY4kIY=; b=XbJOvb92aJYe7BXSQJh/aG4f5tmoLvk8MVoDleIyeOnlafCpOwo9LZFOhvFsaXjI8x fmdOjTVZzwkSD3UitTvNl+PdBsNMvgZrYepmVaPDwFJhixirsObsgv6OVxKe+yee6wxK 4AVzAwfueP95bVLWpPwuy7wHbmCWaE1GLuERkyNQa6LmGTlXd8hk2BCu/7eXGgnpQ3LS 4pMK6AHwRCinf72RNBMPwOwoRrHBigaOn7LN6hU/U6JOgQzE9d9Ka5sjEQBWSwumuGsy TtE24Mc36nyOqK9gc1S6RrEYRR226En56L6z0S/0E/o8MEQ53ugzNS/D6meILywNxEwk 8ATg== X-Gm-Message-State: AElRT7E059nKyVN+rOuGhqKRL2Gf/r3Wi8Pba6NIw9y1rzF15r7FjDDj Tl0OrZGOtKCEh1R9BB0vpHC6aA== X-Received: by 10.98.33.76 with SMTP id h73mr8640882pfh.144.1521144097084; Thu, 15 Mar 2018 13:01:37 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id n7sm10508237pgd.87.2018.03.15.13.01.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 13:01:36 -0700 (PDT) Date: Thu, 15 Mar 2018 13:01:35 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Roman Gushchin cc: Andrew Morton , Michal Hocko , Vladimir Davydov , Johannes Weiner , Tejun Heo , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch -mm] mm, memcg: evaluate root and leaf memcgs fairly on oom In-Reply-To: <20180315164646.GA1853@castle.DHCP.thefacebook.com> Message-ID: References: <20180314121700.GA20850@castle.DHCP.thefacebook.com> <20180315164646.GA1853@castle.DHCP.thefacebook.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 15 Mar 2018, Roman Gushchin wrote: > > Seems like it was dropped from the patch somehow. It is intended to do > > atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and > > atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem(). > > > > > I also doubt that global atomic variable can work here, > > > we probably need something better scaling. > > > > > > > Why do you think an atomic_long_add() is too expensive when we're already > > disabling irqs and dong try_charge()? > > Hard to say without having full code :) > try_charge() is batched, if you'll batch it too, it will probably work. > The full code is what's specified above: it does the atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem(). The patch is comparing the root mem cgroup and leaf mem cgroups fairly. For this, it requires that we have stats that can be directly compared or at least very close approximations. We don't want to get in a situation where root and leaf mem cgroups are being compared based on different stats.