Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp667442ybg; Wed, 10 Jun 2020 10:25:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznqw9Xsz/20ZObXc0PGTsn7/NvNgO3esUpXC9rbp5zkGjj5ZFo3k1/3hr6ZgpFv5pSmIvK X-Received: by 2002:a17:906:51d1:: with SMTP id v17mr4330390ejk.383.1591809908426; Wed, 10 Jun 2020 10:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591809908; cv=none; d=google.com; s=arc-20160816; b=c4NF2ipARWL9uu5cfZUwMX+/7odqcRPJNrkDruwwEqen8SLj+bUnw5CjbXzFonfoBi aSSbIndzvcYHKwMT8wYy2lb0MDb2jUea7323F1Sq3/O3Pm9Ryz2zm3vKsUR2BecjzNxA afeVmW3kuV3Sq0AteVV34mZu+8j/jyLvT5SsD9MeYhGubRF8Vxdaw29FIody76V/eBGH 9UV2HcoD4dzW7b+woq6IqbhFGm2c6SrHqM0Vt2KmTk7mABqVMyF13dQIMuvI957ZaRPc rwItnzHGw7MmVldBYWAdbn+1YkvoSWMuGQm6atVUxNnfP9U3URegKJZckJ1jLPQU2w7F 1Hog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Ook+0bD6nDY7guFSHqX6ZWDJpxvAcnd7uAbxr86fzgA=; b=JPx3fpJehghFoenfbMB53pDiart7QCwMO74UT1WCrrs7c2sVw82QVdNv0ZUn/zrV45 OoxInhaBcGEmC5bWT0QtEsMmE0pACWgMjNnzQxslo4a8jUYs8Ik271ZMZ8DtRHKG9Cha Y085DJ5GBXAbo7ezg5rhr7moj9GUP7nZ/NbDe0eYAnOpK7iHdl5KLwH80MV0/BvW591K 6nEcD6Z06XCwiGj/rm88QM3gPOYO+sGdR1CVrB8E4AB9xsFe+BVMfltrU8DbHFC9bwU9 HHLgRccphNeWqsyCfDihKBhch588P0ERfUXflsx/7vVDC8DdrxoBGJN8REmOh2zzaZrz TQ7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v14si147188edr.110.2020.06.10.10.24.45; Wed, 10 Jun 2020 10:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726482AbgFJQm2 (ORCPT + 99 others); Wed, 10 Jun 2020 12:42:28 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:32939 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726095AbgFJQm1 (ORCPT ); Wed, 10 Jun 2020 12:42:27 -0400 Received: by mail-wm1-f66.google.com with SMTP id j198so5069105wmj.0; 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=CKacqhAyf0TxQgaQC+am7iJo4KA+4beZCpQATGsUODSKFG1n6+gbMS+xITeM8efrf2 RwNU2pKIuPTC7C9WesoJ95uX/dB4Y70hWeGDMWx1sviPw8BQ95HMEAhbzsJL0GD1hpN5 fGUcX4Ru7nPsnzVlzBgp+odeGjcLgptUe1XN/mEshiCbyek/0bdIvsMq8SPGr3ORvM1B Iy9vuTSFRzXZJqloF8g9Q/w8XzaL5bYi0ZyzPQqOo8PMfFG+zafgX3fPEBid5DVP1wdp +DRAtXAbGizIqZHxwWeZYhDmCknpotKAom6da3nkkhU3Tnf+IZtx/CfFaIq7GBUyu+cW /pXQ== X-Gm-Message-State: AOAM532Wdytrk+cKDPNS34GHiUTNpWKGBuW1zFNr4gZ5Lo4Nb57YbuQg HO15SBZpsvki7TfDKEpONt0iqnQT 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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