Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5714635ybp; Tue, 15 Oct 2019 04:04:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRPUyE+rWc/XxXNE0kg6sdbLlALpQObE56zLwUQGCbm02yQ4oRDHA0bETlfrjuACxrshCK X-Received: by 2002:a17:906:4ac8:: with SMTP id u8mr33965536ejt.193.1571137456259; Tue, 15 Oct 2019 04:04:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571137456; cv=none; d=google.com; s=arc-20160816; b=wpU3xuqNWN+pZYJDRblZFGCpt/iMWDQvZTOa71D++0fhOesl9z5vPstU4R0EcPcPO2 7a3BuzODnHPln4/i1NoWAhVr8n0GNr2TBQjAUR3Lls/YU7OR/CzF+Aor4VVd5lrphmRD nsxJNS6F+UHMMncaeoDXqCqlUV4OZCCIJ230NuUdR/Ppl9dgVzLKPx95s+LG8yqyo1Ht T7Kh7m07bBn+04tdtNeARSdGidavVP5apOwt/SKn64fTq9+zgQos3cN8RSi1irOF0Ma8 J3vzDHurRcUw8huwiSgkkFcj98JSYHio1CXw1f/zn+e238XylghvII30x9grp5NfoPlO jGRw== 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; bh=gkGpbmHi90DjX5nEZVJ5v93gFb65zlsIh0TON/3xlc0=; b=J4wRmp8uzTiW+4edOsVqCEyegE4KE53MF/HED9AHw08/jda4i9gYd1xXz5SryjGCax 5mjrYXQvGAh9qQzgZZNW9Gh6r50BMm7QmI/QZTZa533+MXWc4krQOX5IyLBO3K5aLg9u fjD+WTUooj5MJyh0j8fEPxEBBoan2L69nGlH754P1JLLwCG0ZIiU8rhDWx/qWkFq0MHL PIo0yuCI18JEi2aPktvbXIGrxkmkP19EPrfbDv6w0kILlXBQOt6TUtOmfyI7vvhqQcOk 1/VpJ1g4PDVbWzGyYiVpPB4BSVsbATfxtupbnfkVhIEgHjsl3I+5b+0VrrudV5Sp1M0j p2iA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si12455686edx.302.2019.10.15.04.03.51; Tue, 15 Oct 2019 04:04:16 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbfJOIUv (ORCPT + 99 others); Tue, 15 Oct 2019 04:20:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:38462 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726220AbfJOIUu (ORCPT ); Tue, 15 Oct 2019 04:20:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D1171B01F; Tue, 15 Oct 2019 08:20:48 +0000 (UTC) Date: Tue, 15 Oct 2019 10:20:48 +0200 From: Michal Hocko To: Konstantin Khlebnikov Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Vladimir Davydov , Johannes Weiner Subject: Re: [PATCH] mm/memcontrol: update lruvec counters in mem_cgroup_move_account Message-ID: <20191015082048.GU317@dhcp22.suse.cz> References: <157112699975.7360.1062614888388489788.stgit@buzz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <157112699975.7360.1062614888388489788.stgit@buzz> 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 Tue 15-10-19 11:09:59, Konstantin Khlebnikov wrote: > Mapped, dirty and writeback pages are also counted in per-lruvec stats. > These counters needs update when page is moved between cgroups. Please describe the user visible effect. > Fixes: 00f3ca2c2d66 ("mm: memcontrol: per-lruvec stats infrastructure") > Signed-off-by: Konstantin Khlebnikov We want Cc: stable I suspect because broken stats might be really misleading. The patch looks ok to me otherwise Acked-by: Michal Hocko > --- > mm/memcontrol.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index bdac56009a38..363106578876 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -5420,6 +5420,8 @@ static int mem_cgroup_move_account(struct page *page, > struct mem_cgroup *from, > struct mem_cgroup *to) > { > + struct lruvec *from_vec, *to_vec; > + struct pglist_data *pgdat; > unsigned long flags; > unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1; > int ret; > @@ -5443,11 +5445,15 @@ static int mem_cgroup_move_account(struct page *page, > > anon = PageAnon(page); > > + pgdat = page_pgdat(page); > + from_vec = mem_cgroup_lruvec(pgdat, from); > + to_vec = mem_cgroup_lruvec(pgdat, to); > + > spin_lock_irqsave(&from->move_lock, flags); > > if (!anon && page_mapped(page)) { > - __mod_memcg_state(from, NR_FILE_MAPPED, -nr_pages); > - __mod_memcg_state(to, NR_FILE_MAPPED, nr_pages); > + __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages); > + __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages); > } > > /* > @@ -5459,14 +5465,14 @@ static int mem_cgroup_move_account(struct page *page, > struct address_space *mapping = page_mapping(page); > > if (mapping_cap_account_dirty(mapping)) { > - __mod_memcg_state(from, NR_FILE_DIRTY, -nr_pages); > - __mod_memcg_state(to, NR_FILE_DIRTY, nr_pages); > + __mod_lruvec_state(from_vec, NR_FILE_DIRTY, -nr_pages); > + __mod_lruvec_state(to_vec, NR_FILE_DIRTY, nr_pages); > } > } > > if (PageWriteback(page)) { > - __mod_memcg_state(from, NR_WRITEBACK, -nr_pages); > - __mod_memcg_state(to, NR_WRITEBACK, nr_pages); > + __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages); > + __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages); > } > > #ifdef CONFIG_TRANSPARENT_HUGEPAGE -- Michal Hocko SUSE Labs