From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36ADCC433DF for ; Wed, 10 Jun 2020 16:42:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 01C10206F4 for ; Wed, 10 Jun 2020 16:42:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01C10206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 85D508D0001; Wed, 10 Jun 2020 12:42:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80E536B0088; Wed, 10 Jun 2020 12:42:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D5C28D0001; Wed, 10 Jun 2020 12:42:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id 538A26B0087 for ; Wed, 10 Jun 2020 12:42:27 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1325476E1A for ; Wed, 10 Jun 2020 16:42:27 +0000 (UTC) X-FDA: 76913870334.02.chess21_2c0c74f26dcc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id E73A61FEA57 for ; Wed, 10 Jun 2020 16:42:26 +0000 (UTC) X-HE-Tag: chess21_2c0c74f26dcc X-Filterd-Recvd-Size: 3745 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Wed, 10 Jun 2020 16:42:26 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id u26so5062400wmn.1 for ; Wed, 10 Jun 2020 09:42:26 -0700 (PDT) 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; bh=Ook+0bD6nDY7guFSHqX6ZWDJpxvAcnd7uAbxr86fzgA=; b=iFuv1VPwePTr6Xd4LUXkrj99f64afsqepncT4nrGtotr/jn0Z8YG8smtT7xEsOwFSc hvsh+O+8IKpZ5VQyRH80uTQtXKaP902xKTrr+2Jbusf70xkoOVSgGeE4DeIw6Tm1Kmav ckqjrFUXvLcHOcQc9rxp6qqSU8T6BKdJa9NaXiU12Va+cd97NWIuXqOng/g7Rt3qzDsX zQSA1tOx991TZvUE5qFdSsTgXb1hT7dEPwEJKKYcw1sFBX0idjS4OFarsE7JVK4JhmxC rE4NcpVFqZ9rOm+xtMt9qjybsijwPijeVHjnpUkpGvWbdpHZ4wmUZnsHFazpG7uFIB4H M0bA== X-Gm-Message-State: AOAM531NPicvsUZ8z50pYZarbvLSheDM4ur9mKuSHTAJ+KRmdIWlyjku 5zhVd+ssltvixu6oQDJUFWk= X-Google-Smtp-Source: ABdhPJxmYRD6cZbJSPnxkRZsit0PruzpSfdFiZDIgh6S35E8QE1VmM5NhYom44xkETDEF/JI5xHTjQ== X-Received: by 2002:a7b:c18a:: with SMTP id y10mr4245243wmi.73.1591807345411; Wed, 10 Jun 2020 09:42:25 -0700 (PDT) Received: from localhost (ip-37-188-155-130.eurotel.cz. [37.188.155.130]) by smtp.gmail.com with ESMTPSA id s7sm471331wrr.60.2020.06.10.09.42.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 09:42:24 -0700 (PDT) Date: Wed, 10 Jun 2020 18:42:22 +0200 From: Michal Hocko To: Johannes Weiner Cc: Andrew Morton , Alex Shi , Joonsoo Kim , Shakeel Butt , Hugh Dickins , "Kirill A. Shutemov" , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 09/19] mm: memcontrol: switch to native NR_FILE_PAGES and NR_SHMEM counters Message-ID: <20200610164222.GE20204@dhcp22.suse.cz> References: <20200508183105.225460-1-hannes@cmpxchg.org> <20200508183105.225460-10-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200508183105.225460-10-hannes@cmpxchg.org> X-Rspamd-Queue-Id: E73A61FEA57 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 08-05-20 14:30:56, Johannes Weiner wrote: > Memcg maintains private MEMCG_CACHE and NR_SHMEM counters. This > divergence from the generic VM accounting means unnecessary code > overhead, and creates a dependency for memcg that page->mapping is set > up at the time of charging, so that page types can be told apart. > > Convert the generic accounting sites to mod_lruvec_page_state and > friends to maintain the per-cgroup vmstat counters of NR_FILE_PAGES > and NR_SHMEM. The page is already locked in these places, so > page->mem_cgroup is stable; we only need minimal tweaks of two > mem_cgroup_migrate() calls to ensure it's set up in time. > > Then replace MEMCG_CACHE with NR_FILE_PAGES and delete the private > NR_SHMEM accounting sites. > > Signed-off-by: Johannes Weiner > Reviewed-by: Joonsoo Kim While looking at the code I've noticed that add_to_swap_cache resp. __delete_from_swap_cache are accounting only to global counters. Is there any reason for that? Not something that this patch is responsible for of course but I am just wondering. -- Michal Hocko SUSE Labs