Received: by 10.223.176.5 with SMTP id f5csp800077wra; Wed, 7 Feb 2018 07:45:30 -0800 (PST) X-Google-Smtp-Source: AH8x225rL/kaBEeeWva+IRK36j07qF9TbPk/I53PZSxzXgNV5/cs5hHH8yGpDX5t/BcJkQwS5IgM X-Received: by 10.101.83.3 with SMTP id m3mr5267527pgq.396.1518018329901; Wed, 07 Feb 2018 07:45:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518018329; cv=none; d=google.com; s=arc-20160816; b=BmltQran0CahNRHBK6iXnVjmX+DH66vk0DohRVKYi3aszyfng+KclRmImJPCIWTEb0 BKpZEopWXKJNkU+OBnPePA8+YnMwRWq6rm18a+PEVdfwLgtZi1RZ9fmAGkd0Au/SXRul UUyHOd0/zFVvhsQA7eWwPZcElfMwy1QAxPVFb02IT2ZXPKhL6UN/h+0iwOaJTvlmOh2s C4bWBKfU5wdOwDP2d5qTvyDr9eC42OQ1B7Pe2vUqt4L01BKbn/7fXj39QCAVBvca8DkY tWLZq7pTuYGSkfZJz6G4hsGaYbz6EXBNRjJbJ7Rdy25weZWYdjE/PoC52IVyxopXoB89 HZzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ceieI8GRX02JzQZwW8S+/7Fasl+C5z8Hnc6EsaRkFHc=; b=VdRm5nkkZLBoQ1/9oYz7/H5w3aQTRM7SwBB16RJv6EspP0idLSirbtRq7uGHE+gfYB bDcf376Q+RS23udUsMNmnRdyPWOIZS8OauRBpxFcERvzg6UVLXRLDFKfKWAJy3DRa8lT 4je+9dBBkZiuxllnYrEqcqjfjloZYz5/8lCp2qGFWFl1bf6T7sakk+y+HSfH0sM71ejB hf075F0n2mHSgBxGzYVO2klJ0VXjSiPsik8nSXrsSmil9JeTaXvTPco6HbQaKv1NhXQI jEspTdpC2L5siPXnJPQ91qkVMhxy1NoG7ZrWIY328WKJ+buwJOy5XA6UdcAPGOEnl1Jo msAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UCfaV2qx; 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 3-v6si1235074plq.540.2018.02.07.07.45.15; Wed, 07 Feb 2018 07:45:29 -0800 (PST) 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=UCfaV2qx; 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 S1754651AbeBGPoP (ORCPT + 99 others); Wed, 7 Feb 2018 10:44:15 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:55275 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754637AbeBGPoL (ORCPT ); Wed, 7 Feb 2018 10:44:11 -0500 Received: by mail-wm0-f51.google.com with SMTP id i186so3956672wmi.4 for ; Wed, 07 Feb 2018 07:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ceieI8GRX02JzQZwW8S+/7Fasl+C5z8Hnc6EsaRkFHc=; b=UCfaV2qxbClBC9dnYwX10iHmcEEfbs2ItDOHChqPYFgiDz5j/agwVW2oYYZCujpfrB WJCWySz+xkEyq22EH3fhbmcJ4klmPzsSciZ8vhiVyJDWMzUZDRDRi+2IvxXkwInvm8qT YakEpWTjkvxTmVAbnnQevtW/mad3HzOgyVLsV5AoxGdxZEFoXpLGHCAIEFx4l274OlHU TyTkZWVm/rBM2wX+EA/sL8QvFN0DqJlalbDbexw+uqBV7IY1PyRBQ+Sd5YeMm+nEICqi p9eCBlaaQ6z+RgLtedP0dcZ7U33WpETweGsy2A/VyatfFcvzI4B7QNjL+qwqKFq66/Ip jHDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ceieI8GRX02JzQZwW8S+/7Fasl+C5z8Hnc6EsaRkFHc=; b=VuGgMoH5YsriLBmkCoOyzjFdVB+zVTKxA9Sw5wSq8ho13Ym0YQHFljx/Q5wy0oy80r 5OOmCILv+XDHCpuA4O0zv4xamMn4sXSU/C88ZAtdt4VDfG8uytzdXMkTLeXLH1UouCdE 8SiYBbFFtldOwIuKUWfMGtRyBPo+JLM9OqW0DHiRMRFjdOEUKHN233aocDX/JLGK5ANt ehcv9Y9ETo1Pm0UxvGrtbt8NYl5HHZDm5eWdTEUMljG2OZggORPuaw3phTwmVPaNe3pZ UZ+8TVII/CvPDblHnyxLUoeLSMMZJ1X6DdI3q5l/+hp8/Bl6tsT4txLIf4dd3K7nNm6+ ttKg== X-Gm-Message-State: APf1xPAdKosdV4jrHNVwSTzdeMegVrIYNipiViGMxohU7zNgYMVltbX0 XHok84p/EdS84ZNQHSZjRyw2TC6nDBOhBv86nJ5Lew== X-Received: by 10.28.71.198 with SMTP id m67mr5614909wmi.40.1518018249806; Wed, 07 Feb 2018 07:44:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.55.204 with HTTP; Wed, 7 Feb 2018 07:44:08 -0800 (PST) In-Reply-To: <20180203082353.17284-1-hannes@cmpxchg.org> References: <20180203082353.17284-1-hannes@cmpxchg.org> From: Shakeel Butt Date: Wed, 7 Feb 2018 07:44:08 -0800 Message-ID: Subject: Re: [PATCH] mm: memcontrol: fix NR_WRITEBACK leak in memcg and system stats To: Johannes Weiner Cc: Andrew Morton , Tejun Heo , Michal Hocko , Linux MM , Cgroups , LKML , kernel-team@fb.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 3, 2018 at 12:23 AM, Johannes Weiner wrote: > After the ("a983b5ebee57 mm: memcontrol: fix excessive complexity in > memory.stat reporting"), we observed slowly upward creeping > NR_WRITEBACK counts over the course of several days, both the > per-memcg stats as well as the system counter in e.g. /proc/meminfo. > > The conversion from full per-cpu stat counts to per-cpu cached atomic > stat counts introduced an irq-unsafe RMW operation into the updates. > > Most stat updates come from process context, but one notable exception > is the NR_WRITEBACK counter. While writebacks are issued from process > context, they are retired from (soft)irq context. > > When writeback completions interrupt the RMW counter updates of new > writebacks being issued, the decs from the completions are lost. > > Since the global updates are routed through the joint lruvec API, both > the memcg counters as well as the system counters are affected. > > This patch makes the joint stat and event API irq safe. > > Fixes: a983b5ebee57 ("mm: memcontrol: fix excessive complexity in memory.stat reporting") > Debugged-by: Tejun Heo > Signed-off-by: Johannes Weiner Should this be considered for stable?